Decode theme files and use themes that conform to the Hundred Rabbits theme framework.
Decodes a Hundred Rabbits theme SVG file/string into a usable type in Elm.
import Xml.Decode as XD -- from ymtszw/elm-xml-decode
import HRTheme
hundredRabbitsTheme = XD.run HRTheme.decoder xmlStringAlongside the String-based errors the XML decoder might generate, this decoder will generate errors specific to Hundred Rabbits themes:
Missing ID - eg. The ID 'f_low' was not found.
Invalid color hex - eg. The color at ID 'f_high' is not a valid hex color.
Converts a Hundred Rabbits Theme to an XML string so that it can be downloaded to the user as a file.
import File.Download as Download
import HRTheme
save : Theme -> Cmd msg
save theme =
Download.string "theme.svg" "image/svg+xml" (HRTheme.toXmlString theme)
A color theme that uses the Hundred Rabbits theme spec.
Because there's no central Color type in elm, you may have to convert these colours to another type when you get them to be usable.
The Color types used in this record are from
avh4/elm-color.Because it would be impractical to do so, there is no constructor function for this type, you just manually create the record like so: