github-spectrum
The github-spectrum
function finds color codes for any Github language (according to Github Linguist) in either their native HEX format or RGBA
Install
npm install github-spectrum
Usage
var spectrum = ; var color = ;
Examples
Language names are case insensitive and also check through language aliases
as specified per entry in Github Linguist. If a language is not found, either '#cccccc'
or 'rgba(204,204,204,1)'
will be returned by default.
// '#f1e05a' // '#f1e05a' // 'rgba(241,224,90,1)' // '#cccccc' // 'rgba(204,204,204,1)'
Gotchas:
json
As github-spectrum
relies on loading a JSON file with require()
, webpack setups need to include the json-loader. One way is to include it in the preLoaders
:
...preLoaders: test: /.json$/ loader: 'json' ...