colors: Add support for irc color codes

Removed the old color pallette and replace with an iRC compatible one.
This can be updated in the future to provide the colors from the theme.
We could also add specific elements to the pallette so we don't
have to re-use defines that are used by the IRC color codes.
This commit is contained in:
Andy Williams 2015-05-11 23:13:27 +01:00
parent 96e670f85e
commit 474ce07250
10 changed files with 155 additions and 516 deletions

View File

@ -1 +1,2 @@
Chris 'devilhorns' Michael <devilhorns@comcast.net>
Andy 'ajwillia.ms' Williams <andy@andywilliams.me>

View File

@ -17,10 +17,9 @@ am__v_EDJ_ = $(am__v_EDJ_$(AM_DEFAULT_VERBOSITY))
am__v_EDJ_0 = @echo " EDJ " $@;
EXTRA_DIST = \
default.edc \
default_colors.in.edc
default.edc
default.edj: Makefile default.edc default_colors.in.edc
default.edj: Makefile default.edc
$(AM_V_EDJ)$(EDJE_CC) $(EDJE_FLAGS) \
$(top_srcdir)/data/themes/default.edc \
$(top_builddir)/data/themes/default.edj

View File

@ -1,11 +1,3 @@
#ifndef NO_COLORS
color_classes
{
# include "default_colors.in.edc"
# define BG_COL 32 32 32 255
}
#endif
collections
{
#define ICON(grp, img) \
@ -772,7 +764,7 @@ collections
description
{
state: "default" 0.0;
color: BG_COL;
color: 32 32 32 255;
}
}
part

View File

@ -1,351 +0,0 @@
color_class { name: "c0"; color: 170 170 170 255; } // COL_DEF
color_class { name: "c1"; color: 0 0 0 255; } // COL_BLACK
color_class { name: "c2"; color: 204 51 51 255; } // COL_RED
color_class { name: "c3"; color: 51 204 51 255; } // COL_GREEN
color_class { name: "c4"; color: 204 136 51 255; } // COL_YELLOW
color_class { name: "c5"; color: 51 51 204 255; } // COL_BLUE
color_class { name: "c6"; color: 204 51 204 255; } // COL_MAGENTA
color_class { name: "c7"; color: 51 204 204 255; } // COL_CYAN
color_class { name: "c8"; color: 204 204 204 255; } // COL_WHITE
color_class { name: "c9"; color: 0 0 0 0; } // COL_INVIS
color_class { name: "c10"; color: 34 34 34 255; } // COL_INVERSE
color_class { name: "c11"; color: 170 170 170 255; } // COL_INVERSEBG
color_class { name: "c12"; color: 238 238 238 255; } // COL_DEF
color_class { name: "c13"; color: 102 102 102 255; } // COL_BLACK
color_class { name: "c14"; color: 255 102 102 255; } // COL_RED
color_class { name: "c15"; color: 102 255 102 255; } // COL_GREEN
color_class { name: "c16"; color: 255 255 102 255; } // COL_YELLOW
color_class { name: "c17"; color: 102 102 255 255; } // COL_BLUE
color_class { name: "c18"; color: 255 102 255 255; } // COL_MAGENTA
color_class { name: "c19"; color: 102 255 255 255; } // COL_CYAN
color_class { name: "c20"; color: 255 255 255 255; } // COL_WHITE
color_class { name: "c21"; color: 0 0 0 0; } // COL_INVIS
color_class { name: "c22"; color: 17 17 17 255; } // COL_INVERSE
color_class { name: "c23"; color: 238 238 238 255; } // COL_INVERSEBG
color_class { name: "c24"; color: 221 221 221 255; } // COL_DEF
color_class { name: "c25"; color: 0 0 0 255; } // COL_BLACK
color_class { name: "c26"; color: 204 136 136 255; } // COL_RED
color_class { name: "c27"; color: 136 204 136 255; } // COL_GREEN
color_class { name: "c28"; color: 204 170 136 255; } // COL_YELLOW
color_class { name: "c29"; color: 136 136 204 255; } // COL_BLUE
color_class { name: "c30"; color: 204 136 204 255; } // COL_MAGENTA
color_class { name: "c31"; color: 136 204 204 255; } // COL_CYAN
color_class { name: "c32"; color: 204 204 204 255; } // COL_WHITE
color_class { name: "c33"; color: 0 0 0 0; } // COL_INVIS
color_class { name: "c34"; color: 17 17 17 255; } // COL_INVERSE
color_class { name: "c35"; color: 204 204 204 255; } // COL_INVERSEBG
color_class { name: "c36"; color: 255 255 255 255; } // COL_DEF
color_class { name: "c37"; color: 204 204 204 255; } // COL_BLACK
color_class { name: "c38"; color: 255 204 204 255; } // COL_RED
color_class { name: "c39"; color: 204 255 204 255; } // COL_GREEN
color_class { name: "c40"; color: 255 255 204 255; } // COL_YELLOW
color_class { name: "c41"; color: 204 204 255 255; } // COL_BLUE
color_class { name: "c42"; color: 255 204 255 255; } // COL_MAGENTA
color_class { name: "c43"; color: 204 255 255 255; } // COL_CYAN
color_class { name: "c44"; color: 255 255 255 255; } // COL_WHITE
color_class { name: "c45"; color: 0 0 0 0; } // COL_INVIS
color_class { name: "c46"; color: 0 0 0 255; } // COL_INVERSE
color_class { name: "c47"; color: 255 255 255 255; } // COL_INVERSEBG
color_class { name: "C0"; color: 0 0 0 255; } // COL_BLACK
color_class { name: "C1"; color: 204 51 51 255; } // COL_RED
color_class { name: "C2"; color: 51 204 51 255; } // COL_GREEN
color_class { name: "C3"; color: 204 136 51 255; } // COL_YELLOW
color_class { name: "C4"; color: 51 51 204 255; } // COL_BLUE
color_class { name: "C5"; color: 204 51 204 255; } // COL_MAGENTA
color_class { name: "C6"; color: 51 204 204 255; } // COL_CYAN
color_class { name: "C7"; color: 204 204 204 255; } // COL_WHITE
color_class { name: "C8"; color: 102 102 102 255; } // COL_BLACK
color_class { name: "C9"; color: 255 102 102 255; } // COL_RED
color_class { name: "C10"; color: 102 255 102 255; } // COL_GREEN
color_class { name: "C11"; color: 255 255 102 255; } // COL_YELLOW
color_class { name: "C12"; color: 102 102 255 255; } // COL_BLUE
color_class { name: "C13"; color: 255 102 255 255; } // COL_MAGENTA
color_class { name: "C14"; color: 102 255 255 255; } // COL_CYAN
color_class { name: "C15"; color: 255 255 255 255; } // COL_WHITE
#if 0 // disabled, use defaults.
// pure 6x6x6 colorcube
color_class { name: "C16"; color: 0 0 0 255; }
color_class { name: "C17"; color: 0 0 42 255; }
color_class { name: "C18"; color: 0 0 85 255; }
color_class { name: "C19"; color: 0 0 127 255; }
color_class { name: "C20"; color: 0 0 170 255; }
color_class { name: "C21"; color: 0 0 212 255; }
color_class { name: "C22"; color: 0 42 0 255; }
color_class { name: "C23"; color: 0 42 42 255; }
color_class { name: "C24"; color: 0 42 85 255; }
color_class { name: "C25"; color: 0 42 127 255; }
color_class { name: "C26"; color: 0 42 170 255; }
color_class { name: "C27"; color: 0 42 212 255; }
color_class { name: "C28"; color: 0 85 0 255; }
color_class { name: "C29"; color: 0 85 42 255; }
color_class { name: "C30"; color: 0 85 85 255; }
color_class { name: "C31"; color: 0 85 127 255; }
color_class { name: "C32"; color: 0 85 170 255; }
color_class { name: "C33"; color: 0 85 212 255; }
color_class { name: "C34"; color: 0 127 0 255; }
color_class { name: "C35"; color: 0 127 42 255; }
color_class { name: "C36"; color: 0 127 85 255; }
color_class { name: "C37"; color: 0 127 127 255; }
color_class { name: "C38"; color: 0 127 170 255; }
color_class { name: "C39"; color: 0 127 212 255; }
color_class { name: "C40"; color: 0 170 0 255; }
color_class { name: "C41"; color: 0 170 42 255; }
color_class { name: "C42"; color: 0 170 85 255; }
color_class { name: "C43"; color: 0 170 127 255; }
color_class { name: "C44"; color: 0 170 170 255; }
color_class { name: "C45"; color: 0 170 212 255; }
color_class { name: "C46"; color: 0 212 0 255; }
color_class { name: "C47"; color: 0 212 42 255; }
color_class { name: "C48"; color: 0 212 85 255; }
color_class { name: "C49"; color: 0 212 127 255; }
color_class { name: "C50"; color: 0 212 170 255; }
color_class { name: "C51"; color: 0 212 212 255; }
color_class { name: "C52"; color: 42 0 0 255; }
color_class { name: "C53"; color: 42 0 42 255; }
color_class { name: "C54"; color: 42 0 85 255; }
color_class { name: "C55"; color: 42 0 127 255; }
color_class { name: "C56"; color: 42 0 170 255; }
color_class { name: "C57"; color: 42 0 212 255; }
color_class { name: "C58"; color: 42 42 0 255; }
color_class { name: "C59"; color: 42 42 42 255; }
color_class { name: "C60"; color: 42 42 85 255; }
color_class { name: "C61"; color: 42 42 127 255; }
color_class { name: "C62"; color: 42 42 170 255; }
color_class { name: "C63"; color: 42 42 212 255; }
color_class { name: "C64"; color: 42 85 0 255; }
color_class { name: "C65"; color: 42 85 42 255; }
color_class { name: "C66"; color: 42 85 85 255; }
color_class { name: "C67"; color: 42 85 127 255; }
color_class { name: "C68"; color: 42 85 170 255; }
color_class { name: "C69"; color: 42 85 212 255; }
color_class { name: "C70"; color: 42 127 0 255; }
color_class { name: "C71"; color: 42 127 42 255; }
color_class { name: "C72"; color: 42 127 85 255; }
color_class { name: "C73"; color: 42 127 127 255; }
color_class { name: "C74"; color: 42 127 170 255; }
color_class { name: "C75"; color: 42 127 212 255; }
color_class { name: "C76"; color: 42 170 0 255; }
color_class { name: "C77"; color: 42 170 42 255; }
color_class { name: "C78"; color: 42 170 85 255; }
color_class { name: "C79"; color: 42 170 127 255; }
color_class { name: "C80"; color: 42 170 170 255; }
color_class { name: "C81"; color: 42 170 212 255; }
color_class { name: "C82"; color: 42 212 0 255; }
color_class { name: "C83"; color: 42 212 42 255; }
color_class { name: "C84"; color: 42 212 85 255; }
color_class { name: "C85"; color: 42 212 127 255; }
color_class { name: "C86"; color: 42 212 170 255; }
color_class { name: "C87"; color: 42 212 212 255; }
color_class { name: "C88"; color: 85 0 0 255; }
color_class { name: "C89"; color: 85 0 42 255; }
color_class { name: "C90"; color: 85 0 85 255; }
color_class { name: "C91"; color: 85 0 127 255; }
color_class { name: "C92"; color: 85 0 170 255; }
color_class { name: "C93"; color: 85 0 212 255; }
color_class { name: "C94"; color: 85 111 0 255; }
color_class { name: "C95"; color: 85 42 42 255; }
color_class { name: "C96"; color: 85 42 85 255; }
color_class { name: "C97"; color: 85 42 127 255; }
color_class { name: "C98"; color: 85 42 170 255; }
color_class { name: "C99"; color: 85 42 212 255; }
color_class { name: "C100"; color: 85 85 0 255; }
color_class { name: "C101"; color: 85 85 42 255; }
color_class { name: "C102"; color: 85 85 85 255; }
color_class { name: "C103"; color: 85 85 127 255; }
color_class { name: "C104"; color: 85 85 170 255; }
color_class { name: "C105"; color: 85 85 212 255; }
color_class { name: "C106"; color: 85 127 0 255; }
color_class { name: "C107"; color: 85 127 42 255; }
color_class { name: "C108"; color: 85 127 85 255; }
color_class { name: "C109"; color: 85 127 127 255; }
color_class { name: "C110"; color: 85 127 170 255; }
color_class { name: "C111"; color: 85 127 212 255; }
color_class { name: "C112"; color: 85 170 0 255; }
color_class { name: "C113"; color: 85 170 42 255; }
color_class { name: "C114"; color: 85 170 85 255; }
color_class { name: "C115"; color: 85 170 127 255; }
color_class { name: "C116"; color: 85 170 170 255; }
color_class { name: "C117"; color: 85 170 212 255; }
color_class { name: "C118"; color: 85 212 0 255; }
color_class { name: "C119"; color: 85 212 42 255; }
color_class { name: "C120"; color: 85 212 85 255; }
color_class { name: "C121"; color: 85 212 127 255; }
color_class { name: "C122"; color: 85 212 170 255; }
color_class { name: "C123"; color: 85 212 212 255; }
color_class { name: "C124"; color: 127 0 0 255; }
color_class { name: "C125"; color: 127 0 42 255; }
color_class { name: "C126"; color: 127 0 85 255; }
color_class { name: "C127"; color: 127 0 127 255; }
color_class { name: "C128"; color: 127 0 170 255; }
color_class { name: "C129"; color: 127 0 212 255; }
color_class { name: "C130"; color: 127 42 0 255; }
color_class { name: "C131"; color: 127 42 42 255; }
color_class { name: "C132"; color: 127 42 85 255; }
color_class { name: "C133"; color: 127 42 127 255; }
color_class { name: "C134"; color: 127 42 170 255; }
color_class { name: "C135"; color: 127 42 212 255; }
color_class { name: "C136"; color: 127 85 0 255; }
color_class { name: "C137"; color: 127 85 42 255; }
color_class { name: "C138"; color: 127 85 85 255; }
color_class { name: "C139"; color: 127 85 127 255; }
color_class { name: "C140"; color: 127 85 170 255; }
color_class { name: "C141"; color: 127 85 212 255; }
color_class { name: "C142"; color: 127 127 0 255; }
color_class { name: "C143"; color: 127 127 42 255; }
color_class { name: "C144"; color: 127 127 85 255; }
color_class { name: "C145"; color: 127 127 127 255; }
color_class { name: "C146"; color: 127 127 170 255; }
color_class { name: "C147"; color: 127 127 212 255; }
color_class { name: "C148"; color: 127 170 0 255; }
color_class { name: "C149"; color: 127 170 42 255; }
color_class { name: "C150"; color: 127 170 85 255; }
color_class { name: "C151"; color: 127 170 127 255; }
color_class { name: "C152"; color: 127 170 170 255; }
color_class { name: "C153"; color: 127 170 212 255; }
color_class { name: "C154"; color: 127 212 0 255; }
color_class { name: "C155"; color: 127 212 42 255; }
color_class { name: "C156"; color: 127 212 85 255; }
color_class { name: "C157"; color: 127 212 127 255; }
color_class { name: "C158"; color: 127 212 170 255; }
color_class { name: "C159"; color: 127 212 212 255; }
color_class { name: "C160"; color: 170 0 0 255; }
color_class { name: "C161"; color: 170 0 42 255; }
color_class { name: "C162"; color: 170 0 85 255; }
color_class { name: "C163"; color: 170 0 127 255; }
color_class { name: "C164"; color: 170 0 170 255; }
color_class { name: "C165"; color: 170 0 212 255; }
color_class { name: "C166"; color: 170 42 0 255; }
color_class { name: "C167"; color: 170 42 42 255; }
color_class { name: "C168"; color: 170 42 85 255; }
color_class { name: "C169"; color: 170 42 127 255; }
color_class { name: "C170"; color: 170 42 170 255; }
color_class { name: "C171"; color: 170 42 212 255; }
color_class { name: "C172"; color: 170 85 0 255; }
color_class { name: "C173"; color: 170 85 42 255; }
color_class { name: "C174"; color: 170 85 85 255; }
color_class { name: "C175"; color: 170 85 127 255; }
color_class { name: "C176"; color: 170 85 170 255; }
color_class { name: "C177"; color: 170 85 212 255; }
color_class { name: "C178"; color: 170 127 0 255; }
color_class { name: "C179"; color: 170 127 42 255; }
color_class { name: "C180"; color: 170 127 85 255; }
color_class { name: "C181"; color: 170 127 127 255; }
color_class { name: "C182"; color: 170 127 170 255; }
color_class { name: "C183"; color: 170 127 212 255; }
color_class { name: "C184"; color: 170 170 0 255; }
color_class { name: "C185"; color: 170 170 42 255; }
color_class { name: "C186"; color: 170 170 85 255; }
color_class { name: "C187"; color: 170 170 127 255; }
color_class { name: "C188"; color: 170 170 170 255; }
color_class { name: "C189"; color: 170 170 212 255; }
color_class { name: "C190"; color: 170 212 0 255; }
color_class { name: "C191"; color: 170 212 42 255; }
color_class { name: "C192"; color: 170 212 85 255; }
color_class { name: "C193"; color: 170 212 127 255; }
color_class { name: "C194"; color: 170 212 170 255; }
color_class { name: "C195"; color: 170 212 212 255; }
color_class { name: "C196"; color: 212 0 0 255; }
color_class { name: "C197"; color: 212 0 42 255; }
color_class { name: "C198"; color: 212 0 85 255; }
color_class { name: "C199"; color: 212 0 127 255; }
color_class { name: "C200"; color: 212 0 170 255; }
color_class { name: "C201"; color: 212 0 212 255; }
color_class { name: "C202"; color: 212 42 0 255; }
color_class { name: "C203"; color: 212 42 42 255; }
color_class { name: "C204"; color: 212 42 85 255; }
color_class { name: "C205"; color: 212 42 127 255; }
color_class { name: "C206"; color: 212 42 170 255; }
color_class { name: "C207"; color: 212 42 212 255; }
color_class { name: "C208"; color: 212 85 0 255; }
color_class { name: "C209"; color: 212 85 42 255; }
color_class { name: "C210"; color: 212 85 85 255; }
color_class { name: "C211"; color: 212 85 127 255; }
color_class { name: "C212"; color: 212 85 170 255; }
color_class { name: "C213"; color: 212 85 212 255; }
color_class { name: "C214"; color: 212 127 0 255; }
color_class { name: "C215"; color: 212 127 42 255; }
color_class { name: "C216"; color: 212 127 85 255; }
color_class { name: "C217"; color: 212 127 127 255; }
color_class { name: "C218"; color: 212 127 170 255; }
color_class { name: "C219"; color: 212 127 212 255; }
color_class { name: "C220"; color: 212 170 0 255; }
color_class { name: "C221"; color: 212 170 42 255; }
color_class { name: "C222"; color: 212 170 85 255; }
color_class { name: "C223"; color: 212 170 127 255; }
color_class { name: "C224"; color: 212 170 170 255; }
color_class { name: "C225"; color: 212 170 212 255; }
color_class { name: "C226"; color: 212 212 0 255; }
color_class { name: "C227"; color: 212 212 42 255; }
color_class { name: "C228"; color: 212 212 85 255; }
color_class { name: "C229"; color: 212 212 127 255; }
color_class { name: "C230"; color: 212 212 170 255; }
color_class { name: "C231"; color: 212 212 212 255; }
// greyscale ramp (24 not including black and white, so 26 if included)
color_class { name: "C232"; color: 8 8 8 255; }
color_class { name: "C233"; color: 18 18 18 255; }
color_class { name: "C234"; color: 28 28 28 255; }
color_class { name: "C235"; color: 38 38 38 255; }
color_class { name: "C236"; color: 48 48 48 255; }
color_class { name: "C237"; color: 58 58 58 255; }
color_class { name: "C238"; color: 68 68 68 255; }
color_class { name: "C239"; color: 78 78 78 255; }
color_class { name: "C240"; color: 88 88 88 255; }
color_class { name: "C241"; color: 98 98 98 255; }
color_class { name: "C242"; color: 108 108 108 255; }
color_class { name: "C243"; color: 118 118 118 255; }
color_class { name: "C244"; color: 128 128 128 255; }
color_class { name: "C245"; color: 138 138 138 255; }
color_class { name: "C246"; color: 148 148 148 255; }
color_class { name: "C247"; color: 158 158 158 255; }
color_class { name: "C248"; color: 168 168 168 255; }
color_class { name: "C249"; color: 178 178 178 255; }
color_class { name: "C250"; color: 188 188 188 255; }
color_class { name: "C251"; color: 198 198 198 255; }
color_class { name: "C252"; color: 210 210 210 255; }
color_class { name: "C253"; color: 218 218 218 255; }
color_class { name: "C254"; color: 228 228 228 255; }
color_class { name: "C255"; color: 238 238 238 255; }
#endif

View File

@ -2,16 +2,17 @@
#include "callbacks.h"
#include "window.h"
#include "channel.h"
#include "colors.h"
#include <time.h>
#define COLOR_SYSTEM 76
#define COLOR_TEXT 65
#define COLOR_SERVER_NOTICE 14
#define COLOR_CHANNEL_NOTICE 18
#define COLOR_TOPIC 16
#define COLOR_PART 74
#define COLOR_JOIN 75
#define COLOR_NICK_CHANGE 78
#define COLOR_SYSTEM 7
#define COLOR_TEXT DEFAULT_FG_COLOR
#define COLOR_SERVER_NOTICE 3
#define COLOR_CHANNEL_NOTICE 4
#define COLOR_TOPIC 6
#define COLOR_PART 14
#define COLOR_JOIN 16
#define COLOR_NICK_CHANGE 15
static int
_find_crlf(const char *data, int length, int *lf)

View File

@ -6,6 +6,7 @@
#include "grid.h"
#include "utils.h"
#include "commands.h"
#include "colors.h"
struct _Channel
{
@ -259,7 +260,7 @@ _cb_entry_go(void *data, Evas_Object *obj EINA_UNUSED, void *event EINA_UNUSED)
nick = express_network_nickname_get(chl->net);
_channel_text_append(chl, nick, buff,
_row_color_simple_create(0));
_row_color_simple_create(DEFAULT_FG_COLOR));
}
elm_entry_entry_set(chl->o_entry, "");
}
@ -314,7 +315,7 @@ _cb_entry_key_down(void *data, Evas *evas EINA_UNUSED, Evas_Object *obj EINA_UNU
s = eina_strbuf_string_steal(sb);
eina_strbuf_free(sb);
_channel_text_append(chl, "*", s, _row_color_simple_create(0));
_channel_text_append(chl, "*", s, _row_color_simple_create(DEFAULT_FG_COLOR));
}
else
{

View File

@ -1,68 +1,48 @@
#include "private.h"
#include "colors.h"
static const Color colors[2][2][12] =
const Color colors[2][COLOR_COUNT] =
{
{ // normal
{ // normal
{ 0xaa, 0xaa, 0xaa, 0xff }, // COL_DEF
{ 0x00, 0x00, 0x00, 0xff }, // COL_BLACK
{ 0xc0, 0x00, 0x00, 0xff }, // COL_RED
{ 0x00, 0xc0, 0x00, 0xff }, // COL_GREEN
{ 0xc0, 0xc0, 0x00, 0xff }, // COL_YELLOW
{ 0x00, 0x00, 0xc0, 0xff }, // COL_BLUE
{ 0xc0, 0x00, 0xc0, 0xff }, // COL_MAGENTA
{ 0x00, 0xc0, 0xc0, 0xff }, // COL_CYAN
{ 0xc0, 0xc0, 0xc0, 0xff }, // COL_WHITE
{ 0x00, 0x00, 0x00, 0x00 }, // COL_INVIS
{ 0x22, 0x22, 0x22, 0xff }, // COL_INVERSE
{ 0xaa, 0xaa, 0xaa, 0xff }, // COL_INVERSEBG
},
{ // bright/bold
{ 0xee, 0xee, 0xee, 0xff }, // COL_DEF
{ 0xcc, 0xcc, 0xcc, 0xff }, // COL_BLACK
{ 0xcc, 0x88, 0x88, 0xff }, // COL_RED
{ 0x88, 0xcc, 0x88, 0xff }, // COL_GREEN
{ 0xcc, 0xaa, 0x88, 0xff }, // COL_YELLOW
{ 0x88, 0x88, 0xcc, 0xff }, // COL_BLUE
{ 0xcc, 0x88, 0xcc, 0xff }, // COL_MAGENTA
{ 0x88, 0xcc, 0xcc, 0xff }, // COL_CYAN
{ 0xcc, 0xcc, 0xcc, 0xff }, // COL_WHITE
{ 0x00, 0x00, 0x00, 0x00 }, // COL_INVIS
{ 0x11, 0x11, 0x11, 0xff }, // COL_INVERSE
{ 0xee, 0xee, 0xee, 0xff }, // COL_INVERSEBG
},
},
{ // intense
{ // normal
{ 0xdd, 0xdd, 0xdd, 0xff }, // COL_DEF
{ 0x80, 0x80, 0x80, 0xff }, // COL_BLACK
{ 0xff, 0x80, 0x80, 0xff }, // COL_RED
{ 0x80, 0xff, 0x80, 0xff }, // COL_GREEN
{ 0xff, 0xff, 0x80, 0xff }, // COL_YELLOW
{ 0x80, 0x80, 0xff, 0xff }, // COL_BLUE
{ 0xff, 0x80, 0xff, 0xff }, // COL_MAGENTA
{ 0x80, 0xff, 0xff, 0xff }, // COL_CYAN
{ 0xff, 0xff, 0xff, 0xff }, // COL_WHITE
{ 0x00, 0x00, 0x00, 0x00 }, // COL_INVIS
{ 0x11, 0x11, 0x11, 0xff }, // COL_INVERSE
{ 0xcc, 0xcc, 0xcc, 0xff }, // COL_INVERSEBG
},
{ // bright/bold
{ 0xff, 0xff, 0xff, 0xff }, // COL_DEF
{ 0xcc, 0xcc, 0xcc, 0xff }, // COL_BLACK
{ 0xff, 0xcc, 0xcc, 0xff }, // COL_RED
{ 0xcc, 0xff, 0xcc, 0xff }, // COL_GREEN
{ 0xff, 0xff, 0xcc, 0xff }, // COL_YELLOW
{ 0xcc, 0xcc, 0xff, 0xff }, // COL_BLUE
{ 0xff, 0xcc, 0xff, 0xff }, // COL_MAGENTA
{ 0xcc, 0xff, 0xff, 0xff }, // COL_CYAN
{ 0xff, 0xff, 0xff, 0xff }, // COL_WHITE
{ 0x00, 0x00, 0x00, 0x00 }, // COL_INVIS
{ 0x00, 0x00, 0x00, 0xff }, // COL_INVERSE
{ 0xff, 0xff, 0xff, 0xff }, // COL_INVERSEBG
}
}
{ // normal
{ 0xaa, 0xaa, 0xaa, 0xff }, // COL_DEF_FG
{ 0x00, 0x00, 0x00, 0xff }, // COL_BLACK
{ 0x33, 0x33, 0x88, 0xff }, // COL_NAVYBLUE
{ 0x33, 0x88, 0x33, 0xff }, // COL_GREEN
{ 0xcc, 0x33, 0x33, 0xff }, // COL_RED
{ 0x88, 0x33, 0x33, 0xff }, // COL_BROWN
{ 0x88, 0x33, 0x88, 0xff }, // COL_PURPLE
{ 0x88, 0x88, 0x33, 0xff }, // COL_OLIVE
{ 0xcc, 0x88, 0x33, 0xff }, // COL_YELLOW
{ 0x33, 0xcc, 0x33, 0xff }, // COL_LIMEGREEN
{ 0x33, 0x88, 0x88, 0xff }, // COL_TEAL
{ 0x88, 0xcc, 0xcc, 0xff }, // COL_AQUA
{ 0x33, 0x33, 0xcc, 0xff }, // COL_BLUE
{ 0xcc, 0x88, 0xcc, 0xff }, // COL_PINK
{ 0x33, 0x33, 0x33, 0xff }, // COL_DARKGRAY
{ 0x88, 0x88, 0x88, 0xff }, // COL_LIGHTGRAY
{ 0xcc, 0xcc, 0xcc, 0xff }, // COL_WHITE
{ 0x00, 0x00, 0x00, 0x00 }, // COL_DEF_BG
},
{ // bright
{ 0xcc, 0xcc, 0xcc, 0xff }, // COL_BRIGHT_DEF_FG
{ 0xee, 0xee, 0xee, 0xff }, // COL_BRIGHT_BLACK
{ 0x66, 0x66, 0xcc, 0xff }, // COL_BRIGHT_NAVYBLUE
{ 0x66, 0xcc, 0x66, 0xff }, // COL_BRIGHT_GREEN
{ 0xff, 0x66, 0x66, 0xff }, // COL_BRIGHT_RED
{ 0xcc, 0x66, 0x66, 0xff }, // COL_BRIGHT_BROWN
{ 0xcc, 0x66, 0xcc, 0xff }, // COL_BRIGHT_PURPLE
{ 0xcc, 0xcc, 0x66, 0xff }, // COL_BRIGHT_OLIVE
{ 0xff, 0xff, 0xcc, 0xff }, // COL_BRIGHT_YELLOW
{ 0x66, 0xff, 0x66, 0xff }, // COL_BRIGHT_LIMEGREEN
{ 0x66, 0xcc, 0xcc, 0xff }, // COL_BRIGHT_TEAL
{ 0xcc, 0xff, 0xff, 0xff }, // COL_BRIGHT_AQUA
{ 0x66, 0x66, 0xff, 0xff }, // COL_BRIGHT_BLUE
{ 0xff, 0xcc, 0xff, 0xff }, // COL_BRIGHT_PINK
{ 0x66, 0x66, 0x66, 0xff }, // COL_BRIGHT_DARKGRAY
{ 0xcc, 0xcc, 0xcc, 0xff }, // COL_BRIGHT_LIGHTGRAY
{ 0xff, 0xff, 0xff, 0xff }, // COL_BRIGHT_WHITE
{ 0x00, 0x00, 0x00, 0x33 }, // COL_BRIGHT_DEF_BG
},
};
static const Color colors256[256] =
@ -370,49 +350,17 @@ static const Color colors256[256] =
void
_colors_init(Evas_Object *obj, Evas_Object *bg)
{
int c, n;
int c, n, l;
int r, g, b, a;
char buf[32];
for (c = 0; c < 4 * 12; c++)
for (n = 0, l = 0; l < 2; l++) // normal/bright
{
snprintf(buf, sizeof(buf) - 1, "c%i", c);
n = c + (24 * (c / 24));
if (edje_object_color_class_get(bg, buf,
&r, &g, &b, &a,
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL))
{
/* normal */
evas_object_textgrid_palette_set(obj,
EVAS_TEXTGRID_PALETTE_STANDARD,
n, r, g, b, a);
/* faint */
evas_object_textgrid_palette_set(obj,
EVAS_TEXTGRID_PALETTE_STANDARD,
n + 24,
r / 2, g / 2, b / 2, a / 2);
}
else
{
Color color;
color = colors[c / 24][(c % 24) / 12][c % 12];
/* normal */
evas_object_textgrid_palette_set(obj,
EVAS_TEXTGRID_PALETTE_STANDARD,
n, color.r, color.g, color.b,
color.a);
/* faint */
evas_object_textgrid_palette_set(obj,
EVAS_TEXTGRID_PALETTE_STANDARD,
n + 24,
color.r / 2, color.g / 2,
color.b / 2, color.a / 2);
}
for (c = 0; c < COLOR_COUNT; c++, n++) // irc message colors
evas_object_textgrid_palette_set(obj,
EVAS_TEXTGRID_PALETTE_STANDARD,
n, colors[l][c].r, colors[l][c].g,
colors[l][c].b, colors[l][c].a);
}
for (c = 0; c < 256; c++)
@ -443,18 +391,14 @@ _colors_init(Evas_Object *obj, Evas_Object *bg)
}
void
_colors_standard_get(int set, int col, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a)
_colors_standard_get(int bright, int col, unsigned char *r, unsigned char *g, unsigned char *b, unsigned char *a)
{
if ((set >= 0) && (set < 4))
if ((bright >= 0) && (bright < 2))
{
int s1, s2;
s1 = set / 2;
s2 = set % 2;
*r = colors[s1][s2][col].r;
*g = colors[s1][s2][col].g;
*b = colors[s1][s2][col].b;
*a = colors[s1][s2][col].a;
*r = colors[bright][col].r;
*g = colors[bright][col].g;
*b = colors[bright][col].b;
*a = colors[bright][col].a;
return;
}
*r = 0;

View File

@ -1,6 +1,10 @@
#ifndef _COLORS_H_
# define _COLORS_H_ 1
#define COLOR_COUNT 18
#define DEFAULT_FG_COLOR 0
#define DEFAULT_BG_COLOR COLOR_COUNT - 1
typedef struct _Color Color;
struct _Color

View File

@ -1284,14 +1284,14 @@ _smart_apply(Evas_Object *obj)
if ((!cells) || (x >= w))
{
if ((tc[x].codepoint != 0) ||
(tc[x].bg != COL_INVIS) || (tc[x].bg_extended))
(tc[x].bg != DEFAULT_BG_COLOR) || (tc[x].bg_extended))
{
if (ch1 < 0) ch1 = x;
ch2 = x;
}
tc[x].codepoint = 0;
if (inv) tc[x].bg = COL_INVERSEBG;
else tc[x].bg = COL_INVIS;
else tc[x].bg = DEFAULT_BG_COLOR;
tc[x].bg_extended = 0;
tc[x].double_width = 0;
tc[x].underline = 0;
@ -1304,14 +1304,14 @@ _smart_apply(Evas_Object *obj)
if (cells[x].att.invisible)
{
if ((tc[x].codepoint != 0) ||
(tc[x].bg != COL_INVIS) || (tc[x].bg_extended))
(tc[x].bg != DEFAULT_BG_COLOR) || (tc[x].bg_extended))
{
if (ch1 < 0) ch1 = x;
ch2 = x;
}
tc[x].codepoint = 0;
if (inv) tc[x].bg = COL_INVERSEBG;
else tc[x].bg = COL_INVIS;
else tc[x].bg = DEFAULT_BG_COLOR;
tc[x].bg_extended = 0;
tc[x].underline = 0;
tc[x].strikethrough = 0;
@ -1334,17 +1334,17 @@ _smart_apply(Evas_Object *obj)
bgext = cells[x].att.bg256;
codepoint = cells[x].codepoint;
if ((fg == COL_DEF) && (cells[x].att.inverse ^ inv))
if ((fg == DEFAULT_FG_COLOR) && (cells[x].att.inverse ^ inv))
fg = COL_INVERSEBG;
if (bg == COL_DEF)
if (bg == DEFAULT_FG_COLOR)
{
if (cells[x].att.inverse ^ inv)
bg = COL_INVERSE;
else if (!bgext)
bg = COL_INVIS;
bg = DEFAULT_BG_COLOR;
}
if ((cells[x].att.fgintense) && (!fgext)) fg += 48;
if ((cells[x].att.bgintense) && (!bgext)) bg += 48;
if ((cells[x].att.fgintense) && (!fgext)) fg += 18;
if ((cells[x].att.bgintense) && (!bgext)) bg += 18;
if (cells[x].att.inverse ^ inv)
{
int t;
@ -1352,8 +1352,7 @@ _smart_apply(Evas_Object *obj)
t = fgext; fgext = bgext; bgext = t;
t = fg; fg = bg; bg = t;
}
if ((cells[x].att.bold) && (!fgext)) fg += 12;
if ((cells[x].att.faint) && (!fgext)) fg += 24;
if ((cells[x].att.bold) && (!fgext)) fg += 18;
if ((tc[x].codepoint != codepoint) ||
(tc[x].fg != fg) || (tc[x].bg != bg) ||
(tc[x].fg_extended != fgext) ||
@ -1592,7 +1591,7 @@ _line_length(const Grid_Cell *cells, ssize_t nb_cells)
const Grid_Cell *cell;
cell = cells + len;
if ((cell->codepoint != 0) && (cell->att.bg != COL_INVIS))
if ((cell->codepoint != 0) && (cell->att.bg != DEFAULT_BG_COLOR))
return len + 1;
}
@ -1916,6 +1915,17 @@ _text_append(Grid *sd, const Eina_Unicode *codepoints, int len, Row_Color *color
{
Grid_Cell *cells;
int i, j;
Eina_Bool iscolor, bold, italic, underline, reverse;
int fg, bg;
iscolor = bold = italic = underline = reverse = EINA_FALSE;
fg = DEFAULT_FG_COLOR;
bg = DEFAULT_BG_COLOR;
if (color)
{
fg = color->fg_primary_color;
bg = color->bg_primary_color;
}
cells = &(GRID_CELLS(sd, 0, sd->state.cy));
for (i = 0; i < len; i++)
@ -1942,11 +1952,58 @@ _text_append(Grid *sd, const Eina_Unicode *codepoints, int len, Row_Color *color
_cell_codepoint_att_fill(sd, g, sd->state.att,
&(cells[sd->state.cx]), 1);
if (color)
{
cells[sd->state.cx].att.fg = color->fg_primary_color;
cells[sd->state.cx].att.bg = color->bg_primary_color;
}
switch (codepoints[i])
{
case 3:
iscolor = EINA_TRUE;
continue;
case 2:
bold = !bold;
continue;
case 15:
iscolor = bold = italic = underline = reverse = EINA_FALSE;
fg = 1;
continue;
case 29:
italic = !italic;
continue;
case 31:
underline = !underline;
continue;
case 18:
reverse = !reverse;
continue;
}
if (iscolor)
{
if (codepoints[i] == '1' && i + 1 < len && (codepoints[i+1] >= '0' && codepoints[i+1] <= '9'))
{
fg = (codepoints[i] - 48) * 10 + codepoints[i+1] - 48;
i+=1;
}
else
fg = codepoints[i] - 48;
iscolor = EINA_FALSE;
if (fg >= 0 && fg <= 16)
continue;
fg = 1;
continue;
}
if (reverse)
{
cells[sd->state.cx].att.fg = bg;
cells[sd->state.cx].att.bg = fg;
}
else
{
cells[sd->state.cx].att.fg = fg;
cells[sd->state.cx].att.bg = bg;
}
cells[sd->state.cx].att.bold = bold;
cells[sd->state.cx].att.italic = italic;
cells[sd->state.cx].att.underline = underline;
#if defined(SUPPORT_DBLWIDTH)
cells[sd->state.cx].att.dblwidth = _util_dblwidth_get(sd, g);
@ -1997,7 +2054,8 @@ _seq_handle(Grid *sd, Eina_Unicode *c, Eina_Unicode *ce, Row_Color *color)
Eina_Unicode *cc;
int len = 0;
if (c[0] < 0x20)
if (c[0] < 0x20 &&
c[0] != 2 && c[0] != 3 && c[0] != 15 && c[0] != 18 && c[0] != 31)
{
switch (c[0])
{
@ -2015,7 +2073,8 @@ _seq_handle(Grid *sd, Eina_Unicode *c, Eina_Unicode *ce, Row_Color *color)
sd->state.had_cr = 0;
cc = c;
while ((cc < ce) && (*cc >= 0x20) && (*cc != 0x7f))
while ((cc < ce) && (*cc != 0x7f) && (*cc >= 0x20
|| *cc == 2 || *cc == 3 || *cc == 15 || *cc == 18 || *cc == 31))
{
cc++;
len++;
@ -2120,8 +2179,8 @@ _buffer_handle(Grid *sd, const Eina_Unicode *codepoints, int len, Row_Color *col
static void
_att_reset(Grid_Att *att)
{
att->fg = COL_DEF;
att->bg = COL_DEF;
att->fg = DEFAULT_FG_COLOR;
att->bg = DEFAULT_FG_COLOR;
att->bold = 0;
att->faint = 0;
#if defined(SUPPORT_ITALIC)
@ -2489,7 +2548,7 @@ _row_color_simple_create(int fg_primary_color)
if (ret)
{
ret->fg_primary_color = fg_primary_color;
ret->bg_primary_color = 0;
ret->bg_primary_color = DEFAULT_BG_COLOR;
}
return ret;

View File

@ -1,17 +1,6 @@
#ifndef _GRID_H_
# define _GRID_H_ 1
#define COL_DEF 0
#define COL_BLACK 1
#define COL_RED 2
#define COL_GREEN 3
#define COL_YELLOW 4
#define COL_BLUE 5
#define COL_MAGENTA 6
#define COL_CYAN 7
#define COL_WHITE 8
#define COL_INVIS 9
#define COL_INVERSE 10
#define COL_INVERSEBG 11