aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core-commands.c
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2026-05-10 00:15:52 +0200
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2026-05-10 00:15:52 +0200
commit58a0f8def5742248bf235c7c9cd9d3efcb334751 (patch)
tree1e41bcfa8fe8bb5d4964060623e68ab865507cfb /src/core-commands.c
parent26bcf1e04d5fcadc2fa968d7b5ce0e458d0aaa92 (diff)
support "default colors"HEADmaster-fmsbw-cimaster
* The terminal's default foreground and background colors are now used by default (`sciteco --no-profile`), so SciTECO integrates naturally into all terminal color schemes, even dark-on-bright ones. * The default Scintilla colors use only 0x000000 (COLOR_BLACK) and 0xC0C0C0 (COLOR_WHITE) now. * You can use `7EJ` to configure the default colors in color schemes or your profile. All existing color schemes had to disable default colors (`-1,-1,7EJ`) since they wouldn't look well otherwise. * You may add `-1,7EJ` to ~/.teco_ini when using a terminal emulator with a washed-out palettized COLOR_BLACK. We cannot detect the terminal's default colors automatically. * Scinterm updated to v6.0. We require a not-yet-upstreamed patch: https://github.com/orbitalquark/scinterm/pull/40 * In fact, we might decide not to support default colors at all in Scinterm, so this feature should be considered experimental.
Diffstat (limited to 'src/core-commands.c')
-rw-r--r--src/core-commands.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/core-commands.c b/src/core-commands.c
index d2c8b9d..63d8dbc 100644
--- a/src/core-commands.c
+++ b/src/core-commands.c
@@ -2084,7 +2084,7 @@ teco_state_ecommand_flags(teco_machine_main_t *ctx, GError **error)
/*$ EJ properties
* [key]EJ -> value -- Get and set system properties
* value,keyEJ
- * rgb,color,3EJ
+ * [fore,]back,7EJ
* -EJ -> event
* -2EJ -> y, x
*
@@ -2136,6 +2136,7 @@ teco_state_ecommand_flags(teco_machine_main_t *ctx, GError **error)
* first.
* Memory limiting is enabled by default.
* .IP 3:
+ * .SCITECO_TOPIC palette
* This \fBwrite-only\fP property allows disabling use of
* the 16 color palette of default colors when using
* the Curses user interface.
@@ -2188,6 +2189,25 @@ teco_state_ecommand_flags(teco_machine_main_t *ctx, GError **error)
* After changing the interval, the new value may become
* active only after the previous interval expires.
* Recovery files are not dumped in batch mode.
+ * .IP 7:
+ * .SCITECO_TOPIC "default colors"
+ * This \fBwrite-only\fP property allows configuring the default
+ * foreground and background colors, given as two
+ * Scintilla-encoded RGB (0xBBGGRR) numbers.
+ * When asked to draw these colors, the terminal's native
+ * default colors \(em which may be some kind of white on black or
+ * black on white \(em are used instead.
+ * Therefore this command does not change any colors on screen
+ * \(em it just defines placeholder values for the terminal's
+ * default colors.
+ * This may be used e.g. to get a true black background where
+ * the terminal emulator's palette uses a different hue for
+ * Curses color COLOR_BLACK without having to resort to
+ * color redefinitions.
+ * With caution this may even be used to build color schemes that
+ * work both on white on black and black on white terminals.
+ * Use -1 to disable default foreground or background colors.
+ * It has no effect when using the GTK interface.
* .
* .IP -1:
* Type of the last mouse event (\fBread-only\fP).
@@ -2242,7 +2262,8 @@ teco_state_ecommand_properties(teco_machine_main_t *ctx, GError **error)
EJ_PALETTE,
EJ_CARETX,
EJ_CMDLINE_HEIGHT,
- EJ_RECOVERY_INTERVAL
+ EJ_RECOVERY_INTERVAL,
+ EJ_DEFAULT_COLORS
};
static teco_int_t caret_x = 0;
@@ -2298,6 +2319,15 @@ teco_state_ecommand_properties(teco_machine_main_t *ctx, GError **error)
/* FIXME: Perhaps signal the interface to reprogram timers */
break;
+ case EJ_DEFAULT_COLORS: {
+ teco_int_t fore;
+
+ if (!teco_expressions_pop_num_calc(&fore, -1, error))
+ return;
+ teco_interface_set_default_colors(fore, value);
+ break;
+ }
+
default:
g_set_error(error, TECO_ERROR, TECO_ERROR_FAILED,
"Cannot set property %" TECO_INT_FORMAT " "