feat(themes: xresources): recolor titlebar icons; improve comments

This commit is contained in:
actionless 2015-08-02 12:56:57 +02:00 committed by Daniel Hahler
parent 2f340f05ff
commit d1f13975dd
1 changed files with 39 additions and 27 deletions

View File

@ -55,30 +55,41 @@ theme.menu_width = dpi(100)
-- beautiful.variable in your rc.lua -- beautiful.variable in your rc.lua
--theme.bg_widget = "#cc0000" --theme.bg_widget = "#cc0000"
-- Define the image to load -- Recolor titlebar icons:
--theme.titlebar_close_button_normal = "@AWESOME_THEMES_PATH@/default/titlebar/close_normal.png" for _, titlebar_icon in ipairs({
--theme.titlebar_close_button_focus = "@AWESOME_THEMES_PATH@/default/titlebar/close_focus.png" 'titlebar_close_button_normal',
--theme.titlebar_ontop_button_normal_inactive = "@AWESOME_THEMES_PATH@/default/titlebar/ontop_normal_inactive.png" 'titlebar_ontop_button_normal_inactive',
--theme.titlebar_ontop_button_focus_inactive = "@AWESOME_THEMES_PATH@/default/titlebar/ontop_focus_inactive.png" 'titlebar_ontop_button_normal_active',
--theme.titlebar_ontop_button_normal_active = "@AWESOME_THEMES_PATH@/default/titlebar/ontop_normal_active.png"
--theme.titlebar_ontop_button_focus_active = "@AWESOME_THEMES_PATH@/default/titlebar/ontop_focus_active.png"
--theme.titlebar_sticky_button_normal_inactive = "@AWESOME_THEMES_PATH@/default/titlebar/sticky_normal_inactive.png" 'titlebar_sticky_button_normal_inactive',
--theme.titlebar_sticky_button_focus_inactive = "@AWESOME_THEMES_PATH@/default/titlebar/sticky_focus_inactive.png" 'titlebar_sticky_button_normal_active',
--theme.titlebar_sticky_button_normal_active = "@AWESOME_THEMES_PATH@/default/titlebar/sticky_normal_active.png"
--theme.titlebar_sticky_button_focus_active = "@AWESOME_THEMES_PATH@/default/titlebar/sticky_focus_active.png"
--theme.titlebar_floating_button_normal_inactive = "@AWESOME_THEMES_PATH@/default/titlebar/floating_normal_inactive.png" 'titlebar_floating_button_normal_inactive',
--theme.titlebar_floating_button_focus_inactive = "@AWESOME_THEMES_PATH@/default/titlebar/floating_focus_inactive.png" 'titlebar_floating_button_normal_active',
--theme.titlebar_floating_button_normal_active = "@AWESOME_THEMES_PATH@/default/titlebar/floating_normal_active.png"
--theme.titlebar_floating_button_focus_active = "@AWESOME_THEMES_PATH@/default/titlebar/floating_focus_active.png"
--theme.titlebar_maximized_button_normal_inactive = "@AWESOME_THEMES_PATH@/default/titlebar/maximized_normal_inactive.png" 'titlebar_maximized_button_normal_inactive',
--theme.titlebar_maximized_button_focus_inactive = "@AWESOME_THEMES_PATH@/default/titlebar/maximized_focus_inactive.png" 'titlebar_maximized_button_normal_active',
--theme.titlebar_maximized_button_normal_active = "@AWESOME_THEMES_PATH@/default/titlebar/maximized_normal_active.png" }) do
--theme.titlebar_maximized_button_focus_active = "@AWESOME_THEMES_PATH@/default/titlebar/maximized_focus_active.png" theme[titlebar_icon] = recolor_image(theme[titlebar_icon], theme.fg_normal)
end
for _, titlebar_icon in ipairs({
'titlebar_close_button_focus',
'titlebar_ontop_button_focus_inactive',
'titlebar_ontop_button_focus_active',
'titlebar_sticky_button_focus_inactive',
'titlebar_sticky_button_focus_active',
'titlebar_floating_button_focus_inactive',
'titlebar_floating_button_focus_active',
'titlebar_maximized_button_focus_inactive',
'titlebar_maximized_button_focus_active',
}) do
theme[titlebar_icon] = recolor_image(theme[titlebar_icon], theme.fg_focus)
end
-- Recolor layout icons: -- Recolor layout icons:
for _, layout_name in ipairs({ for _, layout_name in ipairs({
@ -102,17 +113,16 @@ for _, layout_name in ipairs({
theme[layout_name] = recolor_image(theme[layout_name], theme.fg_normal) theme[layout_name] = recolor_image(theme[layout_name], theme.fg_normal)
end end
-- Define the icon theme for application icons. If not set then the icons -- Define the icon theme for application icons. If not set then the icons
-- from /usr/share/icons and /usr/share/icons/hicolor will be used. -- from /usr/share/icons and /usr/share/icons/hicolor will be used.
theme.icon_theme = nil theme.icon_theme = nil
-- Generate Awesome icon:
theme.awesome_icon = theme_assets.awesome_icon( theme.awesome_icon = theme_assets.awesome_icon(
theme.menu_height, theme.bg_focus, theme.fg_focus theme.menu_height, theme.bg_focus, theme.fg_focus
) )
-- Taglist squares: -- Generate taglist squares:
local taglist_square_size = dpi(4) local taglist_square_size = dpi(4)
theme.taglist_squares_sel = theme_assets.taglist_squares_sel( theme.taglist_squares_sel = theme_assets.taglist_squares_sel(
taglist_square_size, theme.fg_normal taglist_square_size, theme.fg_normal
@ -121,20 +131,22 @@ theme.taglist_squares_unsel = theme_assets.taglist_squares_unsel(
taglist_square_size, theme.fg_normal taglist_square_size, theme.fg_normal
) )
-- Try to determine if we are running light or dark colorscheme:
local bg_numberic_value = 0; local bg_numberic_value = 0;
for s in theme.bg_normal:gmatch("[a-fA-F0-9][a-fA-F0-9]") do for s in theme.bg_normal:gmatch("[a-fA-F0-9][a-fA-F0-9]") do
bg_numberic_value = bg_numberic_value + tonumber("0x"..s); bg_numberic_value = bg_numberic_value + tonumber("0x"..s);
end end
local is_dark_bg = (bg_numberic_value < 383) local is_dark_bg = (bg_numberic_value < 383)
-- Generate wallpaper:
local wallpaper_bg = xrdb.color8 local wallpaper_bg = xrdb.color8
local wallpaper_fg = xrdb.color7 local wallpaper_fg = xrdb.color7
local wallpaper_alt_wallpaper_fg = xrdb.color12 local wallpaper_alt_fg = xrdb.color12
if not is_dark_bg then if not is_dark_bg then
wallpaper_bg, wallpaper_fg = wallpaper_fg, wallpaper_bg wallpaper_bg, wallpaper_fg = wallpaper_fg, wallpaper_bg
end end
theme.wallpaper = theme_assets.wallpaper( theme.wallpaper = theme_assets.wallpaper(
wallpaper_bg, wallpaper_fg, wallpaper_alt_wallpaper_fg wallpaper_bg, wallpaper_fg, wallpaper_alt_fg
) )
return theme return theme