Allow color words in color functions

This commit is contained in:
robotis
2012-06-25 08:38:12 +00:00
parent 31ff7676eb
commit c4e9d5a11e
4 changed files with 15 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
"""
import colorsys
from . import utility
from lesscpy.lib import colors
class Color():
def process(self, expression):
@@ -332,6 +333,8 @@ class Color():
for h in rgba]
])
def _hextorgb(self, hex):
if hex.lower() in colors.lessColors:
hex = colors.lessColors[hex.lower()]
hex = hex.strip()
if hex[0] == '#':
hex = hex.strip('#').strip(';')

View File

@@ -152,3 +152,7 @@
background-color: #f8b38d;
color: #f1dfda;
}
.names {
color: red;
color: #0000cc;
}

View File

@@ -18,3 +18,4 @@
.grayscale{color:#000000;color:#000000;color:#ffffff;color:#ffffff;color:#2e2e2e;color:#2e2e2e;color:#2e2e2e;color:#2e2e2e;color:#2e2e2e;color:#2e2e2e;}
.mix{color:#7f007f;color:#7f7f7f;color:#7f9055;color:#3f00bf;color:#ff0000;color:#0000ff;}
.vars{color:#f6430f;background-color:#f8b38d;color:#f1dfda;}
.names{color:red;color:#0000cc;}

View File

@@ -164,3 +164,10 @@
@new: hsl(hue(@base), 45%, 90%);
color: @new;
}
/*
Color names
*/
.names {
color: red;
color: darken(BLUE, 10%);
}