From fca2f3e58d800f20581c0e764845a1bbdf346876 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Mon, 11 Feb 2013 14:26:05 +0100 Subject: [PATCH] gears.color: Accept cairo patterns as arguments This allows to use cairo patterns directly for any kind of "color". This makes it easier to use things which aren't possible through gears.color. Signed-off-by: Uli Schlachter --- lib/gears/color.lua.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/gears/color.lua.in b/lib/gears/color.lua.in index 2f2387155..5b94e04f0 100644 --- a/lib/gears/color.lua.in +++ b/lib/gears/color.lua.in @@ -182,6 +182,10 @@ color.types = { -- @param col The string describing the pattern. -- @return a cairo pattern object function color.create_pattern(col) + -- If it already is a cairo pattern, just leave it as that + if cairo.Pattern:is_type_of(col) then + return col + end if type(col) == "string" then local t = string.match(col, "[^:]+") if color.types[t] then