#define HINT_CONTAINER_ID "__hint_container"
#define HINT_CLASS "__hint"
-#define ELEM_BACKGROUND "#ff0"
-#define ELEM_BACKGROUND_FOCUS "#8f0"
-#define ELEM_COLOR "#000"
-
#define HINT_CONTAINER_STYLE "line-height:1em;"
#define HINT_STYLE "z-index:100000;"\
"position:absolute;"\
g_free(num);
/* change the style of the hinted element */
- dom_element_style_set_property(newHint->elem, "background-color", ELEM_BACKGROUND);
- dom_element_style_set_property(newHint->elem, "color", ELEM_COLOR);
+ dom_element_style_set_property(newHint->elem, "background-color", vp.style.hint_bg);
+ dom_element_style_set_property(newHint->elem, "color", vp.style.hint_fg);
webkit_dom_node_append_child(WEBKIT_DOM_NODE(container), WEBKIT_DOM_NODE(hint), NULL);
}
Hint* hint = hints_get_hint_by_number(vp.hints.focusNum);
if (hint) {
/* reset previous focused element */
- dom_element_style_set_property(hint->elem, "background-color", ELEM_BACKGROUND);
+ dom_element_style_set_property(hint->elem, "background-color", vp.style.hint_bg);
doc = webkit_dom_node_get_owner_document(WEBKIT_DOM_NODE(hint->elem));
dom_dispatch_mouse_event(doc, hint->elem, "mouseout", 0);
hint = hints_get_hint_by_number(num);
if (hint) {
/* mark new hint as focused */
- dom_element_style_set_property(hint->elem, "background-color", ELEM_BACKGROUND_FOCUS);
+ dom_element_style_set_property(hint->elem, "background-color", vp.style.hint_bg_focus);
doc = webkit_dom_node_get_owner_document(WEBKIT_DOM_NODE(hint->elem));
dom_dispatch_mouse_event(doc, hint->elem, "mouseover", 0);
#define VP_WIDGET_OVERRIDE_FONT gtk_widget_modify_font
#endif
+#define HEX_COLOR_LEN 8
+
/* enums */
typedef enum _vp_mode {
VP_MODE_NORMAL = 1<<0,
VpColor comp_fg[VP_COMP_LAST];
VpColor comp_bg[VP_COMP_LAST];
PangoFontDescription* comp_font[VP_COMP_LAST];
+ /* hint style */
+ gchar hint_bg[HEX_COLOR_LEN];
+ gchar hint_bg_focus[HEX_COLOR_LEN];
+ gchar hint_fg[HEX_COLOR_LEN];
} Style;
typedef struct {
static gboolean setting_status_font(const Setting* s);
static gboolean setting_input_style(const Setting* s);
static gboolean setting_completion_style(const Setting* s);
+static gboolean setting_hint_style(const Setting* s);
static Setting default_settings[] = {
/* webkit settings */
{NULL, "completion-fg-active", TYPE_CHAR, setting_completion_style, {.s = "#fff"}},
{NULL, "completion-bg-normal", TYPE_CHAR, setting_completion_style, {.s = "#656565"}},
{NULL, "completion-bg-active", TYPE_CHAR, setting_completion_style, {.s = "#777777"}},
+ {NULL, "hint-bg", TYPE_CHAR, setting_hint_style, {.s = "#ff0"}},
+ {NULL, "hint-bg-focus", TYPE_CHAR, setting_hint_style, {.s = "#8f0"}},
+ {NULL, "hint-fg", TYPE_CHAR, setting_hint_style, {.s = "#000"}},
};
return TRUE;
}
+
+static gboolean setting_hint_style(const Setting* s)
+{
+ Style* style = &vp.style;
+ if (!g_strcmp0(s->name, "hint-bg")) {
+ strncpy(style->hint_bg, s->arg.s, HEX_COLOR_LEN - 1);
+ style->hint_bg[HEX_COLOR_LEN - 1] = '\0';
+ } else if (!g_strcmp0(s->name, "hint-bg-focus")) {
+ strncpy(style->hint_bg_focus, s->arg.s, HEX_COLOR_LEN - 1);
+ style->hint_bg_focus[HEX_COLOR_LEN] = '\0';
+ } else if (!g_strcmp0(s->name, "hint-fg")) {
+ strncpy(style->hint_fg, s->arg.s, HEX_COLOR_LEN - 1);
+ style->hint_fg[HEX_COLOR_LEN - 1] = '\0';
+ }
+
+ return TRUE;
+}