+/** @brief Default style for layouts */
+GtkStyle *layout_style;
+
+/** @brief Title-row style for layouts */
+GtkStyle *title_style;
+
+/** @brief Even-row style for layouts */
+GtkStyle *even_style;
+
+/** @brief Odd-row style for layouts */
+GtkStyle *odd_style;
+
+/** @brief Active-row style for layouts */
+GtkStyle *active_style;
+
+/** @brief Style for tools */
+GtkStyle *tool_style;
+
+/** @brief Style for search results */
+GtkStyle *search_style;
+
+/** @brief Style for drag targets */
+GtkStyle *drag_style;
+
+/** @brief Table of styles */
+static const struct {
+ const char *name;
+ GtkStyle **style;
+} styles[] = {
+ { "layout", &layout_style },
+ { "title", &title_style },
+ { "even", &even_style },
+ { "odd", &odd_style },
+ { "active", &active_style },
+ { "tool", &tool_style },
+ { "search", &search_style },
+ { "drag", &drag_style },
+};
+
+#define NSTYLES (sizeof styles / sizeof *styles)
+
+/** @brief Table of state types */
+static const char *const states[] = {
+ "normal",
+ "active",
+ "prelight",
+ "selected",
+ "insensitive"
+};
+
+#define NSTATES (sizeof states / sizeof *states)
+
+/** @brief Table of colors */
+static const struct {
+ const char *name;
+ size_t offset;
+} colors[] = {
+ { "fg", offsetof(GtkStyle, fg) },
+ { "bg", offsetof(GtkStyle, bg) },
+};
+
+#define NCOLORS (sizeof colors / sizeof *colors)
+
+/** @brief Initialize styles */
+void init_styles(void) {
+ layout_style = gtk_style_new();
+ title_style = gtk_style_new();
+ even_style = gtk_style_new();
+ odd_style = gtk_style_new();
+ active_style = gtk_style_new();
+ search_style = gtk_style_new();
+ tool_style = gtk_style_new();
+ drag_style = gtk_style_new();
+
+ /* Style defaults */
+
+ /* Layouts are basically black on white */
+ layout_style->bg[GTK_STATE_NORMAL] = layout_style->white;
+ layout_style->fg[GTK_STATE_NORMAL] = layout_style->black;
+
+ /* Title row is inverted */
+ title_style->bg[GTK_STATE_NORMAL] = layout_style->fg[GTK_STATE_NORMAL];
+ title_style->fg[GTK_STATE_NORMAL] = layout_style->bg[GTK_STATE_NORMAL];
+
+ /* Active row is pastel green */
+ active_style->bg[GTK_STATE_NORMAL].red = 0xE000;
+ active_style->bg[GTK_STATE_NORMAL].green = 0xFFFF;
+ active_style->bg[GTK_STATE_NORMAL].blue = 0xE000;
+ active_style->fg[GTK_STATE_NORMAL] = layout_style->fg[GTK_STATE_NORMAL];
+
+ /* Even rows are pastel red */
+ even_style->bg[GTK_STATE_NORMAL].red = 0xFFFF;
+ even_style->bg[GTK_STATE_NORMAL].green = 0xEC00;
+ even_style->bg[GTK_STATE_NORMAL].blue = 0xEC00;
+ even_style->fg[GTK_STATE_NORMAL] = layout_style->fg[GTK_STATE_NORMAL];
+
+ /* Odd rows match the underlying layout */
+ odd_style->bg[GTK_STATE_NORMAL] = layout_style->bg[GTK_STATE_NORMAL];
+ odd_style->fg[GTK_STATE_NORMAL] = layout_style->fg[GTK_STATE_NORMAL];
+
+ /* Search results have a yellow background */
+ search_style->fg[GTK_STATE_NORMAL] = layout_style->fg[GTK_STATE_NORMAL];
+ search_style->bg[GTK_STATE_NORMAL].red = 0xFFFF;
+ search_style->bg[GTK_STATE_NORMAL].green = 0xFFFF;
+ search_style->bg[GTK_STATE_NORMAL].blue = 0x0000;
+
+ /* Drag targets are grey */
+ drag_style->bg[GTK_STATE_NORMAL].red = 0x6666;
+ drag_style->bg[GTK_STATE_NORMAL].green = 0x6666;
+ drag_style->bg[GTK_STATE_NORMAL].blue = 0x6666;
+
+ /* Tools we leave at GTK+ defaults */
+}
+