Skip to content

Commit

Permalink
Don't fail on colors in ARGB format.
Browse files Browse the repository at this point in the history
We currently just ignore the A part, but at least we don't fail.
Closes #178.
  • Loading branch information
jgm committed Nov 16, 2023
1 parent 0ec8892 commit 14929ef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions skylighting-core/src/Skylighting/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ instance ToColor String where
case reads ['(','0','x',r1,r2,',','0','x',g1,g2,',','0','x',b1,b2,')'] of
((r,g,b),_) : _ -> Just $ RGB r g b
_ -> Nothing
toColor ['#',_,_,r1,r2,g1,g2,b1,b2] = -- ARGB format, we just ignore the A
case reads ['(','0','x',r1,r2,',','0','x',g1,g2,',','0','x',b1,b2,')'] of
((r,g,b),_) : _ -> Just $ RGB r g b
_ -> Nothing
toColor _ = Nothing

instance ToColor Int where
Expand Down

0 comments on commit 14929ef

Please sign in to comment.