Skip to content

Commit

Permalink
made album color in trackwin configurable
Browse files Browse the repository at this point in the history
Closes #443
  • Loading branch information
jolange authored and mahkoh committed May 1, 2017
1 parent 12db04a commit 8029b0a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
9 changes: 9 additions & 0 deletions Doc/cmus.txt
Expand Up @@ -923,6 +923,15 @@ color_win_title_fg (white) [`Color`]
color_win_title_attr (default) [`Attributes`]
Attributes of window titles (topmost line of the screen).

color_trackwin_album_bg (default) [`Color`]
Background color of the album row shown in the track window.

color_trackwin_album_fg (default) [`Color`]
Foreground color of the album row shown in the track window.

color_trackwin_album_attr (bold) [`Attributes`]
Attributes of the album row shown in the track window.

confirm_run (true)
Ask for confirmation before executing *:run*

Expand Down
8 changes: 8 additions & 0 deletions options.c
Expand Up @@ -114,6 +114,9 @@ int colors[NR_COLORS] = {
COLOR_WHITE | BRIGHT,
COLOR_BLUE,
COLOR_WHITE | BRIGHT,
-1,

-1,
};

int attrs[NR_ATTRS] = {
Expand All @@ -126,6 +129,8 @@ int attrs[NR_ATTRS] = {
A_NORMAL,
A_NORMAL,
A_NORMAL,
A_NORMAL,
A_BOLD,
};

/* uninitialized option variables */
Expand Down Expand Up @@ -1386,6 +1391,8 @@ static const char * const color_names[NR_COLORS] = {
"color_win_sel_fg",
"color_win_title_bg",
"color_win_title_fg",
"color_trackwin_album_bg",
"color_trackwin_album_fg",
};

static const char * const attr_names[NR_ATTRS] = {
Expand All @@ -1399,6 +1406,7 @@ static const char * const attr_names[NR_ATTRS] = {
"color_win_inactive_sel_attr",
"color_win_sel_attr",
"color_win_title_attr",
"color_trackwin_album_attr",
};

LIST_HEAD(option_head);
Expand Down
4 changes: 4 additions & 0 deletions options.h
Expand Up @@ -94,6 +94,9 @@ enum {
COLOR_WIN_SEL_FG,
COLOR_WIN_TITLE_BG,
COLOR_WIN_TITLE_FG,
COLOR_TRACKWIN_ALBUM_BG,

COLOR_TRACKWIN_ALBUM_FG,
NR_COLORS
};

Expand All @@ -108,6 +111,7 @@ enum {
COLOR_WIN_INACTIVE_SEL_ATTR,
COLOR_WIN_SEL_ATTR,
COLOR_WIN_TITLE_ATTR,
COLOR_TRACKWIN_ALBUM_ATTR,
NR_ATTRS
};

Expand Down
12 changes: 9 additions & 3 deletions ui_curses.c
Expand Up @@ -172,6 +172,8 @@ enum {
CURSED_ERROR,
CURSED_INFO,

CURSED_TRACKWIN_ALBUM,

NR_CURSED
};

Expand All @@ -195,6 +197,8 @@ static unsigned char cursed_to_bg_idx[NR_CURSED] = {
COLOR_WIN_BG,
COLOR_CMDLINE_BG,
COLOR_CMDLINE_BG,

COLOR_TRACKWIN_ALBUM_BG,
};

static unsigned char cursed_to_fg_idx[NR_CURSED] = {
Expand All @@ -217,6 +221,8 @@ static unsigned char cursed_to_fg_idx[NR_CURSED] = {
COLOR_WIN_DIR,
COLOR_ERROR,
COLOR_INFO,

COLOR_TRACKWIN_ALBUM_FG,
};

static unsigned char cursed_to_attr_idx[NR_CURSED] = {
Expand All @@ -239,6 +245,8 @@ static unsigned char cursed_to_attr_idx[NR_CURSED] = {
COLOR_WIN_ATTR,
COLOR_CMDLINE_ATTR,
COLOR_CMDLINE_ATTR,

COLOR_TRACKWIN_ALBUM_ATTR,
};

/* index is CURSED_*, value is fucking color pair */
Expand Down Expand Up @@ -762,9 +770,7 @@ static void print_track(struct window *win, int row, struct iter *iter)
int pos;
struct fp_len len;

/* Output the album name in the same color as unselected
* track name, but with BOLD attribute. */
bkgdset(pairs[CURSED_WIN] | A_BOLD);
bkgdset(pairs[CURSED_TRACKWIN_ALBUM]);

fill_track_fopts_album(album);

Expand Down

0 comments on commit 8029b0a

Please sign in to comment.