aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-07-21 09:06:28 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-07-21 09:06:28 +0000
commit4109d9726398f59e0a183c4f44adc19b6d7346be (patch)
tree018d1b95dcb83df36bd848fff82c03004d3c38f0 /main.c
parentterm: prepare for configurable colors; add color variables to terminal (diff)
conf: config now provides the colors (though still only hardcoded colors)
Diffstat (limited to 'main.c')
-rw-r--r--main.c46
1 files changed, 34 insertions, 12 deletions
diff --git a/main.c b/main.c
index 3903bf66..aedc1a29 100644
--- a/main.c
+++ b/main.c
@@ -36,14 +36,6 @@
#define min(x, y) ((x) < (y) ? (x) : (y))
#define max(x, y) ((x) > (y) ? (x) : (y))
-#if 0
-static const struct rgb default_foreground = {0.86, 0.86, 0.86};
-static const struct rgb default_background = {0.067, 0.067, 0.067};
-#else
-static const uint32_t default_foreground = 0xdcdccc;
-static const uint32_t default_background = 0x111111;
-#endif
-
static void
shm_format(void *data, struct wl_shm *wl_shm, uint32_t format)
{
@@ -335,8 +327,8 @@ main(int argc, char *const *argv)
.vt = {
.state = 1, /* STATE_GROUND */
.attrs = {
- .foreground = default_foreground,
- .background = default_background,
+ //.foreground = conf.colors.fg,
+ //.background = conf.colors.bg
},
},
.kbd = {
@@ -346,8 +338,30 @@ main(int argc, char *const *argv)
.cmd = REPEAT_STOP,
},
},
- .colors.fg = default_foreground,
- .colors.bg = default_background,
+ .colors = {
+ .default_fg = conf.colors.fg,
+ .default_bg = conf.colors.bg,
+ .default_regular = {
+ conf.colors.regular[0],
+ conf.colors.regular[1],
+ conf.colors.regular[2],
+ conf.colors.regular[3],
+ conf.colors.regular[4],
+ conf.colors.regular[5],
+ conf.colors.regular[6],
+ conf.colors.regular[7],
+ },
+ .default_bright = {
+ conf.colors.bright[0],
+ conf.colors.bright[1],
+ conf.colors.bright[2],
+ conf.colors.bright[3],
+ conf.colors.bright[4],
+ conf.colors.bright[5],
+ conf.colors.bright[6],
+ conf.colors.bright[7],
+ },
+ },
.selection = {
.start = {-1, -1},
.end = {-1, -1},
@@ -357,6 +371,14 @@ main(int argc, char *const *argv)
.grid = &term.normal,
};
+ /* Initialize 'current' colors from the default colors */
+ term.colors.fg = term.colors.default_fg;
+ term.colors.bg = term.colors.default_bg;
+ for (size_t i = 0; i < 8; i++) {
+ term.colors.regular[i] = term.colors.default_regular[i];
+ term.colors.bright[i] = term.colors.default_bright[i];
+ }
+
if (term.ptmx == -1) {
LOG_ERRNO("failed to open pseudo terminal");
goto out;