mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-24 01:40:12 -05:00
config: move cursor.color to colors.cursor
This commit is contained in:
parent
a7276d9dff
commit
624c383a1f
7 changed files with 69 additions and 31 deletions
|
|
@ -64,7 +64,15 @@
|
|||
## Unreleased
|
||||
### Added
|
||||
### Changed
|
||||
|
||||
* `cursor.color` moved to `colors.cursor`.
|
||||
|
||||
|
||||
### Deprecated
|
||||
|
||||
* `cursor.color` config option; use `colors.cursor` instead.
|
||||
|
||||
|
||||
### Removed
|
||||
### Fixed
|
||||
### Security
|
||||
|
|
|
|||
41
config.c
41
config.c
|
|
@ -1445,6 +1445,20 @@ parse_section_colors(struct context *ctx)
|
|||
return true;
|
||||
}
|
||||
|
||||
else if (streq(key, "cursor")) {
|
||||
if (!value_to_two_colors(
|
||||
ctx,
|
||||
&conf->colors.cursor.text,
|
||||
&conf->colors.cursor.cursor,
|
||||
false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
conf->colors.use_custom.cursor = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
else if (streq(key, "urls")) {
|
||||
if (!value_to_color(ctx, &conf->colors.url, false))
|
||||
return false;
|
||||
|
|
@ -1537,17 +1551,24 @@ parse_section_cursor(struct context *ctx)
|
|||
return value_to_uint32(ctx, 10, &conf->cursor.blink.rate_ms);
|
||||
|
||||
else if (streq(key, "color")) {
|
||||
LOG_WARN("%s:%d: cursor.color: deprecated; use colors.cursor instead",
|
||||
ctx->path, ctx->lineno);
|
||||
|
||||
user_notification_add(
|
||||
&conf->notifications,
|
||||
USER_NOTIFICATION_DEPRECATED,
|
||||
xstrdup("cursor.color: use colors.cursor instead"));
|
||||
|
||||
if (!value_to_two_colors(
|
||||
ctx,
|
||||
&conf->cursor.color.text,
|
||||
&conf->cursor.color.cursor,
|
||||
false))
|
||||
ctx,
|
||||
&conf->colors.cursor.text,
|
||||
&conf->colors.cursor.cursor,
|
||||
false))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
conf->cursor.color.text |= 1u << 31;
|
||||
conf->cursor.color.cursor |= 1u << 31;
|
||||
conf->colors.use_custom.cursor = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -3356,6 +3377,10 @@ config_load(struct config *conf, const char *conf_path,
|
|||
.alpha_mode = ALPHA_MODE_DEFAULT,
|
||||
.selection_fg = 0x80000000, /* Use default bg */
|
||||
.selection_bg = 0x80000000, /* Use default fg */
|
||||
.cursor = {
|
||||
.text = 0,
|
||||
.cursor = 0,
|
||||
},
|
||||
.use_custom = {
|
||||
.selection = false,
|
||||
.jump_label = false,
|
||||
|
|
@ -3371,10 +3396,6 @@ config_load(struct config *conf, const char *conf_path,
|
|||
.enabled = false,
|
||||
.rate_ms = 500,
|
||||
},
|
||||
.color = {
|
||||
.text = 0,
|
||||
.cursor = 0,
|
||||
},
|
||||
.beam_thickness = {.pt = 1.5},
|
||||
.underline_thickness = {.pt = 0., .px = -1},
|
||||
},
|
||||
|
|
|
|||
12
config.h
12
config.h
|
|
@ -149,7 +149,12 @@ struct color_theme {
|
|||
ALPHA_MODE_DEFAULT,
|
||||
ALPHA_MODE_MATCHING,
|
||||
ALPHA_MODE_ALL
|
||||
} alpha_mode;
|
||||
} alpha_mode;
|
||||
|
||||
struct {
|
||||
uint32_t text;
|
||||
uint32_t cursor;
|
||||
} cursor;
|
||||
|
||||
struct {
|
||||
uint32_t fg;
|
||||
|
|
@ -174,6 +179,7 @@ struct color_theme {
|
|||
} search_box;
|
||||
|
||||
struct {
|
||||
bool cursor:1;
|
||||
bool selection:1;
|
||||
bool jump_label:1;
|
||||
bool scrollback_indicator:1;
|
||||
|
|
@ -306,10 +312,6 @@ struct config {
|
|||
bool enabled;
|
||||
uint32_t rate_ms;
|
||||
} blink;
|
||||
struct {
|
||||
uint32_t text;
|
||||
uint32_t cursor;
|
||||
} color;
|
||||
struct pt_or_px beam_thickness;
|
||||
struct pt_or_px underline_thickness;
|
||||
} cursor;
|
||||
|
|
|
|||
|
|
@ -898,15 +898,6 @@ applications can change these at runtime.
|
|||
enabled. Expressed in milliseconds between each blink. Default:
|
||||
_500_.
|
||||
|
||||
*color*
|
||||
Two space separated RRGGBB values (i.e. plain old 6-digit hex
|
||||
values, without prefix) specifying the foreground (text) and
|
||||
background (cursor) colors for the cursor.
|
||||
|
||||
Example: *ff0000 00ff00* (green cursor, red text)
|
||||
|
||||
Default: the regular foreground and background colors, reversed.
|
||||
|
||||
*beam-thickness*
|
||||
Thickness (width) of the beam styled cursor. The value is in
|
||||
points, and its exact value thus depends on the monitor's DPI. To
|
||||
|
|
@ -967,6 +958,15 @@ The colors are in RRGGBB format (i.e. plain old 6-digit hex values,
|
|||
without prefix). That is, they do *not* have an alpha component. You
|
||||
can configure the background transparency with the _alpha_ option.
|
||||
|
||||
*cursor*
|
||||
Two space separated RRGGBB values (i.e. plain old 6-digit hex
|
||||
values, without prefix) specifying the foreground (text) and
|
||||
background (cursor) colors for the cursor.
|
||||
|
||||
Example: *ff0000 00ff00* (green cursor, red text)
|
||||
|
||||
Default: the regular foreground and background colors, reversed.
|
||||
|
||||
*foreground*
|
||||
Default foreground color. This is the color used when no ANSI
|
||||
color is being used. Default: _839496_.
|
||||
|
|
|
|||
3
foot.ini
3
foot.ini
|
|
@ -85,7 +85,6 @@
|
|||
|
||||
[cursor]
|
||||
# style=block
|
||||
# color=<inverse foreground/background>
|
||||
# blink=no
|
||||
# blink-rate=500
|
||||
# beam-thickness=1.5
|
||||
|
|
@ -106,6 +105,8 @@
|
|||
# flash=7f7f00
|
||||
# flash-alpha=0.5
|
||||
|
||||
# cursor=<inverse foreground/background>
|
||||
|
||||
## Normal/regular colors (color palette 0-7)
|
||||
# regular0=242424 # black
|
||||
# regular1=f62b5a # red
|
||||
|
|
|
|||
10
osc.c
10
osc.c
|
|
@ -1570,8 +1570,14 @@ osc_dispatch(struct terminal *term)
|
|||
|
||||
case 112:
|
||||
LOG_DBG("resetting cursor color");
|
||||
term->colors.cursor_fg = term->conf->cursor.color.text;
|
||||
term->colors.cursor_bg = term->conf->cursor.color.cursor;
|
||||
term->colors.cursor_fg = term->conf->colors.cursor.text;
|
||||
term->colors.cursor_bg = term->conf->colors.cursor.cursor;
|
||||
|
||||
if (term->conf->colors.use_custom.cursor) {
|
||||
term->colors.cursor_fg |= 1u << 31;
|
||||
term->colors.cursor_bg |= 1u << 31;
|
||||
}
|
||||
|
||||
term_damage_cursor(term);
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -1298,8 +1298,8 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper,
|
|||
.fg = conf->colors.fg,
|
||||
.bg = conf->colors.bg,
|
||||
.alpha = conf->colors.alpha,
|
||||
.cursor_fg = conf->cursor.color.text,
|
||||
.cursor_bg = conf->cursor.color.cursor,
|
||||
.cursor_fg = (conf->colors.use_custom.cursor ? 1u << 31 : 0) | conf->colors.cursor.text,
|
||||
.cursor_bg = (conf->colors.use_custom.cursor ? 1u << 31 : 0) | conf->colors.cursor.cursor,
|
||||
.selection_fg = conf->colors.selection_fg,
|
||||
.selection_bg = conf->colors.selection_bg,
|
||||
.use_custom_selection = conf->colors.use_custom.selection,
|
||||
|
|
@ -2153,8 +2153,8 @@ term_reset(struct terminal *term, bool hard)
|
|||
term->colors.fg = term->conf->colors.fg;
|
||||
term->colors.bg = term->conf->colors.bg;
|
||||
term->colors.alpha = term->conf->colors.alpha;
|
||||
term->colors.cursor_fg = term->conf->cursor.color.text;
|
||||
term->colors.cursor_bg = term->conf->cursor.color.cursor;
|
||||
term->colors.cursor_fg = (term->conf->colors.use_custom.cursor ? 1u << 31 : 0) | term->conf->colors.cursor.text;
|
||||
term->colors.cursor_bg = (term->conf->colors.use_custom.cursor ? 1u << 31 : 0) | term->conf->colors.cursor.cursor;
|
||||
term->colors.selection_fg = term->conf->colors.selection_fg;
|
||||
term->colors.selection_bg = term->conf->colors.selection_bg;
|
||||
term->colors.use_custom_selection = term->conf->colors.use_custom.selection;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue