A collection of all of Github's language colors in Elm. Automatically updated using ozh/github-colors, and autogenerated by elm-codegen.
See this in action on Ellie
import Html exposing (Html)
import Html.Attributes exposing (style)
import GithubColors
main : Html msg
main =
Html.div
[ style "color" GithubColors.elm.hex ]
[ Html.text "Elm" ]
A full list of languages can be found in the docs.
Each variable in the GithubColors
holds the color information of a single Github language.
Github does not have colors for all languages! For the languages with no colors, I've defaulted to "#ccc", which is what Github does in most cases. You can programmatically check if a language has a color by using the .hasColor
field.
Each variable is a Color
type that looks like the following:
type alias Color =
-- an elm-ui color
{ elmui : Element.Color
-- an elm-color color
, color : Color.Color
-- a hex string (e.g. "#60B5CC")
, hex : String
-- an rgb tuple
, rgb : ( Int, Int, Int )
-- false if the language does not have a color
, hasColor : Bool
}
Language names are converted to lowercase and most non-alphanumeric characters are replaced by underscores except when they are relevant to the name (e.g. c++, f#). Languages starting with a number gets prefixed by "lang_".
E.g.
- "Elm" becomes "elm"
- "C#" becomes "c_sharp"
- "C++" becomes "cpp"
- "2-Dimensional Array" becomes "lang_2_dimensional_array"
If you find any issues with the language naming, please submit an issue or a PR!
pnpm i && pnpm get-colors
pnpm dev