~alcinnz/Mondrian

8e840900a34a462f221f86aa7c0345ada46a1827 — Adrian Cochrane 1 year, 6 months ago a345546
Handle initial colour values.
1 files changed, 5 insertions(+), 2 deletions(-)

M lib/Graphics/Rendering/Rect/CSS/Colour.hs
M lib/Graphics/Rendering/Rect/CSS/Colour.hs => lib/Graphics/Rendering/Rect/CSS/Colour.hs +5 -2
@@ 28,12 28,15 @@ data ColourPallet = ColourPallet {
}

instance PropertyParser ColourPallet where
    temp = ColourPallet { foreground = opaque blue, accent = opaque blue }
    temp = ColourPallet { foreground = opaque black, accent = opaque blue }
    inherit = id
    priority _ = ["color", "accent"]

    longhand _ self "color" [Ident "initial"]=Just self {foreground=opaque black}
    longhand _ self "color" toks | Just ([], val) <- parseColour self toks =
        Just self { foreground = val }
    longhand _ self "accent-color" [Ident kw]
        | kw `elem` ["initial", "auto"] = Just self {accent = opaque blue}
    longhand _ self "accent-color" t | Just ([], val) <- parseColour self t =
        Just self { accent = val }
    longhand _ _ _ _ = Nothing


@@ 232,7 235,7 @@ parseColour _ (Ident x:toks) | Txt.toLower x == "transparent" =
    Just (toks, transparent)
-- FIXME: Add infrastructure to prioritize resolving `color`
parseColour self (Ident x:toks)
    | Txt.toLower x == "currentcolor" = Just (toks, foreground self)
    | Txt.toLower x `elem` ["currentcolor","initial"]=Just (toks,foreground self)
    | Txt.toLower x == "accentcolor" = Just (toks, accent self)

parseColour _ (Function "hsl":h':Comma: