Socket
Socket
Sign inDemoInstall

@financial-times/o-colors

Package Overview
Dependencies
Maintainers
18
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@financial-times/o-colors - npm Package Compare versions

Comparing version 6.0.7 to 6.0.8

8

demos/src/contrast-checker/contrast-checker.js
import { getContrastRatio, getWCAGRating } from '../shared/contrast-ratio.js';
import { getHexValues, mixHexes } from '../shared/colors-mix.js';
import { getHexValues, mixHexes, expandHexValues } from '../shared/colors-mix.js';

@@ -20,4 +20,4 @@ document.addEventListener('DOMContentLoaded', () => {

function showContrastRatio(text, background) {
const textHex = changeColor(text.value, 'foreground');
const backgroundHex = changeColor(background.value, 'background');
const textHex = expandHexValues(changeColor(text.value, 'foreground'));
const backgroundHex = expandHexValues(changeColor(background.value, 'background'));

@@ -46,3 +46,3 @@ const ratio = getContrastRatio(textHex, backgroundHex);

root.style.setProperty(`--${property}`, hexValue);
return hexValue;
return hexValue.replace('#', '').trim();
}

@@ -49,0 +49,0 @@

@@ -22,2 +22,4 @@ const getHexValues = (mixer, base) => {

const mixHexes = (mixer, base) => {
const fullMixer = expandHexValues(mixer);
const fullBase = expandHexValues(base);
const radix = 16;

@@ -34,4 +36,4 @@ const decimalToHex = decimal => decimal.toString(radix);

for (let i = 0; i <= 5; i += 2) {
const mixPair = hexToDecimal(expandHexValues(mixer.substr(i, 2))); // extract r, g, b pairs for mixer color
const basePair = hexToDecimal(expandHexValues(base.substr(i, 2))); // extract r, g, b pairs for base color
const mixPair = hexToDecimal(fullMixer.substr(i, 2)); // extract r, g, b pairs for mixer color
const basePair = hexToDecimal(fullBase.substr(i, 2)); // extract r, g, b pairs for base color

@@ -52,3 +54,4 @@ // combine the r/g/b pairs from each color, based on percentage

getHexValues,
mixHexes
mixHexes,
expandHexValues
};
{
"name": "@financial-times/o-colors",
"type": "module",
"version": "6.0.7",
"version": "6.0.8",
"description": "The default colour palette for all FT products. The palette supports colour contrast checking, colour mixing and toneing.",

@@ -6,0 +6,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc