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:
Uli Schlachter 2013-02-11 14:26:05 +01:00
parent 03759b4847
commit fca2f3e58d
1 changed files with 4 additions and 0 deletions

View File

@ -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