diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-11-21 22:14:18 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-11-21 22:14:18 +0100 |
commit | 7bae0b1bc84a95d565ffab38cf7f82ad21c656b6 (patch) | |
tree | 2d724ddd855892ef212f14924e2cc04feafa5abe /src/gui.c | |
parent | 94d9f4fa65bce6f116cf89bfdabdf5a06509056f (diff) | |
download | vim-git-7bae0b1bc84a95d565ffab38cf7f82ad21c656b6.tar.gz |
patch 8.1.2331: the option.c file is still very bigv8.1.2331
Problem: The option.c file is still very big.
Solution: Move a few functions to where they fit better. (Yegappan
Lakshmanan, closes #4895)
Diffstat (limited to 'src/gui.c')
-rw-r--r-- | src/gui.c | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -4742,6 +4742,29 @@ gui_get_lightness(guicolor_T pixel) + ((rgb & 0xff) * 114)) / 1000; } + char_u * +gui_bg_default(void) +{ + if (gui_get_lightness(gui.back_pixel) < 127) + return (char_u *)"dark"; + return (char_u *)"light"; +} + +/* + * Option initializations that can only be done after opening the GUI window. + */ + void +init_gui_options(void) +{ + /* Set the 'background' option according to the lightness of the + * background color, unless the user has set it already. */ + if (!option_was_set((char_u *)"bg") && STRCMP(p_bg, gui_bg_default()) != 0) + { + set_option_value((char_u *)"bg", 0L, gui_bg_default(), 0); + highlight_changed(); + } +} + #if defined(FEAT_GUI_X11) || defined(PROTO) void gui_new_scrollbar_colors(void) |