{"version":3,"sources":["../../../../src/nhsuk/core/helpers/_colour.scss"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,eAAe;AACf,gBAAgB;AAChB,gBAAgB;AAChB,kBAAkB;AAClB,uCAAuC;;AAEvC,GAAG;AACH,wBAAwB;AACxB,GAAG;;AAEH,EAAE;AACF,aAAa;AACb,EAAE;AACF,4EAA4E;AAC5E,uBAAuB;AACvB,kDAAkD;AAClD,EAAE;AACF,8DAA8D;;AAE9D;EACE;IACE,mCAAmC;EACrC;;EAEA;IACE,oCAAoC;EACtC;;EAEA,wCAAwC;AAC1C;;AAEA,qEAAqE;AACrE,wEAAwE;AACxE,EAAE;AACF,8DAA8D;AAC9D,EAAE;AACF,2FAA2F;AAC3F,mBAAmB;;AAEnB;EACE;IACE,8BAA8B;EAChC;;EAEA,4BAA4B;EAC5B,UAAU;;EAEV,yEAAyE;EACzE,wEAAwE;EACxE,4DAA4D;EAC5D;IACE;;;;;KAKC;EACH,EAAE;IACA,qCAAqC;IACrC,uCAAuC;;IAEvC;;;;;KAKC;EACH;;EAEA,wCAAwC;AAC1C;;AAEA,+CAA+C;AAC/C,EAAE;AACF,gBAAgB;AAChB,oCAAoC;AACpC,4CAA4C;AAC5C,EAAE;AACF,4CAA4C;AAC5C,wEAAwE;AACxE,mBAAmB;;AAEnB;EACE,4EAA4E;EAC5E,6CAA6C;EAC7C,uEAAuE;AACzE;;AAEA,gDAAgD;AAChD,EAAE;AACF,gBAAgB;AAChB,mCAAmC;AACnC,2CAA2C;AAC3C,EAAE;AACF,2CAA2C;AAC3C,wEAAwE;AACxE,mBAAmB;;AAEnB;EACE,4EAA4E;EAC5E,6CAA6C;EAC7C,uEAAuE;AACzE","file":"_colour.scss","sourcesContent":["@use \"sass:color\";\n@use \"sass:map\";\n@use \"sass:math\";\n@use \"sass:meta\";\n@use \"sass:string\";\n@use \"../settings/colours-palette\" as *;\n\n////\n/// @group helpers/colour\n////\n\n///\n/// Get colour\n///\n/// @param {String | Colour} $colour - Name of colour from the colour palette\n///   (`$nhsuk-colours`)\n/// @return {Colour} Representation of named colour\n///\n/// @throw if `$colour` is not a colour from the colour palette\n\n@function nhsuk-colour($colour) {\n  @if meta.type-of($colour) == \"color\" {\n    $colour: string.quote(\"#{$colour}\");\n  }\n\n  @if not map.has-key($nhsuk-colours, $colour) {\n    @error \"Unknown colour `#{$colour}`\";\n  }\n\n  @return map.get($nhsuk-colours, $colour);\n}\n\n/// Converts a colour with potential float values for its RGB channels\n/// into hexadecimal notation where possible (e.g. no alpha transparency)\n///\n/// This ensures the colour is rendered properly by Safari < 12\n///\n/// @param {String | Colour} $colour - The colour to convert or name from the colour palette\n/// @return {Colour}\n\n@function nhsuk-colour-compatible($colour) {\n  @if meta.type-of($colour) == \"string\" {\n    $colour: nhsuk-colour($colour);\n  }\n\n  $alpha: color.alpha($colour);\n  $parts: ();\n\n  // Maintain compatibility with Sass < v1.79.0 where colour space functions\n  // are unavailable and RGB channels are automatically rounded to integers\n  // https://github.com/sass/dart-sass/blob/1.79.0/CHANGELOG.md\n  @if not meta.function-exists(\"channel\", \"color\") {\n    $parts: (\n      \"red\": color.red($colour),\n      \"green\": color.green($colour),\n      \"blue\": color.blue($colour),\n      \"alpha\": $alpha\n    );\n  } @else {\n    $colour: color.to-space($colour, rgb);\n    $alpha: color.channel($colour, \"alpha\");\n\n    $parts: (\n      \"red\": math.round(color.channel($colour, \"red\")),\n      \"green\": math.round(color.channel($colour, \"green\")),\n      \"blue\": math.round(color.channel($colour, \"blue\")),\n      \"alpha\": $alpha\n    );\n  }\n\n  @return color.change($colour, $parts...);\n}\n\n/// Make a colour darker by mixing it with black\n///\n/// @example scss\n///   nhsuk-shade(color, percentage);\n///   nhsuk-shade(nhsuk-colour(\"blue\"), 50%);\n///\n/// @param {Colour} $colour - colour to shade\n/// @param {Number} $percentage - percentage of black to mix with $colour\n/// @return {Colour}\n\n@function nhsuk-shade($colour, $percentage) {\n  // Ensure the output is a hex string so that Safari <12 can render the colour\n  // without issues from float values in `rgb()`\n  @return nhsuk-colour-compatible(color.mix(black, $colour, $percentage));\n}\n\n/// Make a colour lighter by mixing it with white\n///\n/// @example scss\n///   nhsuk-tint(color, percentage);\n///   nhsuk-tint(nhsuk-colour(\"blue\"), 10%);\n///\n/// @param {Colour} $colour - colour to tint\n/// @param {Number} $percentage - percentage of white to mix with $colour\n/// @return {Colour}\n\n@function nhsuk-tint($colour, $percentage) {\n  // Ensure the output is a hex string so that Safari <12 can render the colour\n  // without issues from float values in `rgb()`\n  @return nhsuk-colour-compatible(color.mix(white, $colour, $percentage));\n}\n"]}
