Skip to content

Instantly share code, notes, and snippets.

@36degrees
Last active February 13, 2018 17:22
Show Gist options
  • Save 36degrees/ae651a5fec495020c85129b4b40a80c1 to your computer and use it in GitHub Desktop.
Save 36degrees/ae651a5fec495020c85129b4b40a80c1 to your computer and use it in GitHub Desktop.
// Map of colours to hex values
$_govuk-colours: (
purple: #2e358b,
mauve: #6f72af,
fuschia: #912b88,
pink: #d53880
// etc
);
// Map of deprecated colours and the version in which they will be removed
$_govuk-colours-deprecated: (
purple: "2.0.0"
);
// Helper function to look-up a colour from the list. Should always use this
// function rather than referencing the map directly.
@function govuk-colour($colour) {
@if (map-has-key($_govuk-colours-deprecated, $colour)) {
$version: map-get($_govuk-colours-deprecated, $colour);
@warn "The colour #{$colour} is deprecated and will be removed in v#{$version}";
}
@return map-get($govuk-colours, $colour);
}
.app-button {
background: govuk-colour(purple);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment