From bc9196084ab062c630e7e3a10153c84374e7644c Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 18 Sep 2008 17:07:04 +0200 Subject: [PATCH] awful: strip alpha channel in pango colors Signed-off-by: Julien Danjou --- lib/awful.lua.in | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/awful.lua.in b/lib/awful.lua.in index 8e465177..fab592f3 100644 --- a/lib/awful.lua.in +++ b/lib/awful.lua.in @@ -71,6 +71,16 @@ client.urgent = {} client.urgent.stack = {} client.urgent.stack.data = {} +--- Strip alpha part of color. +-- @param color The color. +-- @return The color without alpha channel. +local function color_strip_alpha(color) + if color:len() == 9 then + color = color:sub(1, 7) + end + return color +end + --- Make i cycle. -- @param t A length. -- @param i An absolute index to fit into #t. @@ -1058,7 +1068,7 @@ local function prompt_text_with_cursor(text, text_color, cursor_color, cursor_po end local text_start = escape(text:sub(1, cursor_pos - 1)) local text_end = escape(text:sub(cursor_pos + 1)) - return text_start .. "" .. char .. "" .. text_end + return text_start .. "" .. char .. "" .. text_end end --- Run a prompt in a box. @@ -1328,7 +1338,7 @@ function widget.taglist.label.all(t, args) end end if bg_color and fg_color then - text = " "..escape(t.name).." " + text = " "..escape(t.name).." " else text = " "..escape(t.name).." " end @@ -1370,7 +1380,7 @@ function widget.taglist.label.noempty(t, args) end end if fg_color and bg_color then - text = " " .. escape(t.name) .. " " + text = " " .. escape(t.name) .. " " else text = " " .. escape(t.name) .. " " end @@ -1396,12 +1406,12 @@ local function widget_tasklist_label_common(c, args) end if capi.client.focus == c then if bg_focus and fg_focus then - text = text .. " "..name.." " + text = text .. " "..name.." " else text = text .. " "..name.." " end elseif c.urgent and bg_urgent and fg_urgent then - text = text .. " "..name.." " + text = text .. " "..name.." " else text = text .. " "..name.." " end