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 <psychon@znc.in>
This commit is contained in:
parent
03759b4847
commit
fca2f3e58d
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue