@coreui/coreui 5.4.2 → 5.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/css/coreui-grid.css +1 -1
- package/dist/css/coreui-grid.css.map +1 -1
- package/dist/css/coreui-grid.min.css +1 -1
- package/dist/css/coreui-grid.min.css.map +1 -1
- package/dist/css/coreui-grid.rtl.css +1 -1
- package/dist/css/coreui-grid.rtl.css.map +1 -1
- package/dist/css/coreui-grid.rtl.min.css +1 -1
- package/dist/css/coreui-grid.rtl.min.css.map +1 -1
- package/dist/css/coreui-reboot.css +5 -1
- package/dist/css/coreui-reboot.css.map +1 -1
- package/dist/css/coreui-reboot.min.css +2 -2
- package/dist/css/coreui-reboot.min.css.map +1 -1
- package/dist/css/coreui-reboot.rtl.css +5 -1
- package/dist/css/coreui-reboot.rtl.css.map +1 -1
- package/dist/css/coreui-reboot.rtl.min.css +2 -2
- package/dist/css/coreui-reboot.rtl.min.css.map +1 -1
- package/dist/css/coreui-utilities.css +1 -1
- package/dist/css/coreui-utilities.css.map +1 -1
- package/dist/css/coreui-utilities.min.css +1 -1
- package/dist/css/coreui-utilities.min.css.map +1 -1
- package/dist/css/coreui-utilities.rtl.css +1 -1
- package/dist/css/coreui-utilities.rtl.css.map +1 -1
- package/dist/css/coreui-utilities.rtl.min.css +1 -1
- package/dist/css/coreui-utilities.rtl.min.css.map +1 -1
- package/dist/css/coreui.css +6 -1
- package/dist/css/coreui.css.map +1 -1
- package/dist/css/coreui.min.css +2 -2
- package/dist/css/coreui.min.css.map +1 -1
- package/dist/css/coreui.rtl.css +6 -1
- package/dist/css/coreui.rtl.css.map +1 -1
- package/dist/css/coreui.rtl.min.css +2 -2
- package/dist/css/coreui.rtl.min.css.map +1 -1
- package/dist/css/themes/bootstrap/bootstrap.css +24 -19
- package/dist/css/themes/bootstrap/bootstrap.css.map +1 -1
- package/dist/css/themes/bootstrap/bootstrap.min.css +2 -2
- package/dist/css/themes/bootstrap/bootstrap.min.css.map +1 -1
- package/dist/css/themes/bootstrap/bootstrap.rtl.css +23 -18
- package/dist/css/themes/bootstrap/bootstrap.rtl.css.map +1 -1
- package/dist/css/themes/bootstrap/bootstrap.rtl.min.css +2 -2
- package/dist/css/themes/bootstrap/bootstrap.rtl.min.css.map +1 -1
- package/dist/js/bootstrap.bundle.js +2 -2
- package/dist/js/bootstrap.bundle.js.map +1 -1
- package/dist/js/bootstrap.bundle.min.js +2 -2
- package/dist/js/bootstrap.bundle.min.js.map +1 -1
- package/dist/js/bootstrap.esm.js +2 -2
- package/dist/js/bootstrap.esm.js.map +1 -1
- package/dist/js/bootstrap.esm.min.js +2 -2
- package/dist/js/bootstrap.esm.min.js.map +1 -1
- package/dist/js/bootstrap.js +2 -2
- package/dist/js/bootstrap.js.map +1 -1
- package/dist/js/bootstrap.min.js +2 -2
- package/dist/js/bootstrap.min.js.map +1 -1
- package/dist/js/coreui.bundle.js +2 -2
- package/dist/js/coreui.bundle.js.map +1 -1
- package/dist/js/coreui.bundle.min.js +2 -2
- package/dist/js/coreui.bundle.min.js.map +1 -1
- package/dist/js/coreui.esm.js +2 -2
- package/dist/js/coreui.esm.js.map +1 -1
- package/dist/js/coreui.esm.min.js +2 -2
- package/dist/js/coreui.esm.min.js.map +1 -1
- package/dist/js/coreui.js +2 -2
- package/dist/js/coreui.js.map +1 -1
- package/dist/js/coreui.min.js +2 -2
- package/dist/js/coreui.min.js.map +1 -1
- package/js/dist/alert.js +1 -1
- package/js/dist/base-component.js +2 -2
- package/js/dist/base-component.js.map +1 -1
- package/js/dist/button.js +1 -1
- package/js/dist/carousel.js +1 -1
- package/js/dist/collapse.js +1 -1
- package/js/dist/dom/data.js +1 -1
- package/js/dist/dom/event-handler.js +1 -1
- package/js/dist/dom/manipulator.js +1 -1
- package/js/dist/dom/selector-engine.js +1 -1
- package/js/dist/dropdown.js +1 -1
- package/js/dist/modal.js +1 -1
- package/js/dist/navigation.js +1 -1
- package/js/dist/offcanvas.js +1 -1
- package/js/dist/popover.js +1 -1
- package/js/dist/scrollspy.js +1 -1
- package/js/dist/sidebar.js +1 -1
- package/js/dist/tab.js +1 -1
- package/js/dist/toast.js +1 -1
- package/js/dist/tooltip.js +1 -1
- package/js/dist/util/backdrop.js +1 -1
- package/js/dist/util/component-functions.js +1 -1
- package/js/dist/util/config.js +1 -1
- package/js/dist/util/focustrap.js +1 -1
- package/js/dist/util/index.js +1 -1
- package/js/dist/util/sanitizer.js +1 -1
- package/js/dist/util/scrollbar.js +1 -1
- package/js/dist/util/swipe.js +1 -1
- package/js/dist/util/template-factory.js +1 -1
- package/js/src/base-component.js +1 -1
- package/package.json +9 -9
- package/scss/_banner.scss +1 -1
- package/scss/_reboot.scss +6 -0
- package/scss/_spinners.scss +1 -0
- package/scss/functions/_color-contrast-variables.scss +1 -1
- package/scss/functions/_color-contrast.scss +1 -1
- package/scss/functions/_contrast-ratio.scss +10 -6
package/js/dist/alert.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* CoreUI base-component.js v5.4.
|
|
2
|
+
* CoreUI base-component.js v5.4.3 (https://coreui.io)
|
|
3
3
|
* Copyright 2025 The CoreUI Team (https://github.com/orgs/coreui/people)
|
|
4
4
|
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
|
|
5
5
|
*/
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* Constants
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
-
const VERSION = '5.4.
|
|
27
|
+
const VERSION = '5.4.3';
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Class definition
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-component.js","sources":["../src/base-component.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * CoreUI base-component.js\n * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)\n *\n * This component is a modified version of the Bootstrap's base-component.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Data from './dom/data.js'\nimport EventHandler from './dom/event-handler.js'\nimport Config from './util/config.js'\nimport { executeAfterTransition, getElement } from './util/index.js'\n\n/**\n * Constants\n */\n\nconst VERSION = '5.4.
|
|
1
|
+
{"version":3,"file":"base-component.js","sources":["../src/base-component.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * CoreUI base-component.js\n * Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)\n *\n * This component is a modified version of the Bootstrap's base-component.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Data from './dom/data.js'\nimport EventHandler from './dom/event-handler.js'\nimport Config from './util/config.js'\nimport { executeAfterTransition, getElement } from './util/index.js'\n\n/**\n * Constants\n */\n\nconst VERSION = '5.4.3'\n\n/**\n * Class definition\n */\n\nclass BaseComponent extends Config {\n constructor(element, config) {\n super()\n\n element = getElement(element)\n if (!element) {\n return\n }\n\n this._element = element\n this._config = this._getConfig(config)\n\n Data.set(this._element, this.constructor.DATA_KEY, this)\n }\n\n // Public\n dispose() {\n Data.remove(this._element, this.constructor.DATA_KEY)\n EventHandler.off(this._element, this.constructor.EVENT_KEY)\n\n for (const propertyName of Object.getOwnPropertyNames(this)) {\n this[propertyName] = null\n }\n }\n\n // Private\n _queueCallback(callback, element, isAnimated = true) {\n executeAfterTransition(callback, element, isAnimated)\n }\n\n _getConfig(config) {\n config = this._mergeConfigObj(config, this._element)\n config = this._configAfterMerge(config)\n this._typeCheckConfig(config)\n return config\n }\n\n // Static\n static getInstance(element) {\n return Data.get(getElement(element), this.DATA_KEY)\n }\n\n static getOrCreateInstance(element, config = {}) {\n return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null)\n }\n\n static get VERSION() {\n return VERSION\n }\n\n static get DATA_KEY() {\n return `coreui.${this.NAME}`\n }\n\n static get EVENT_KEY() {\n return `.${this.DATA_KEY}`\n }\n\n static eventName(name) {\n return `${name}${this.EVENT_KEY}`\n }\n}\n\nexport default BaseComponent\n"],"names":["VERSION","BaseComponent","Config","constructor","element","config","getElement","_element","_config","_getConfig","Data","set","DATA_KEY","dispose","remove","EventHandler","off","EVENT_KEY","propertyName","Object","getOwnPropertyNames","_queueCallback","callback","isAnimated","executeAfterTransition","_mergeConfigObj","_configAfterMerge","_typeCheckConfig","getInstance","get","getOrCreateInstance","NAME","eventName","name"],"mappings":";;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;EAOA;EACA;EACA;;EAEA,MAAMA,OAAO,GAAG,OAAO;;EAEvB;EACA;EACA;;EAEA,MAAMC,aAAa,SAASC,MAAM,CAAC;EACjCC,EAAAA,WAAWA,CAACC,OAAO,EAAEC,MAAM,EAAE;EAC3B,IAAA,KAAK,EAAE;EAEPD,IAAAA,OAAO,GAAGE,mBAAU,CAACF,OAAO,CAAC;MAC7B,IAAI,CAACA,OAAO,EAAE;EACZ,MAAA;EACF,IAAA;MAEA,IAAI,CAACG,QAAQ,GAAGH,OAAO;MACvB,IAAI,CAACI,OAAO,GAAG,IAAI,CAACC,UAAU,CAACJ,MAAM,CAAC;EAEtCK,IAAAA,IAAI,CAACC,GAAG,CAAC,IAAI,CAACJ,QAAQ,EAAE,IAAI,CAACJ,WAAW,CAACS,QAAQ,EAAE,IAAI,CAAC;EAC1D,EAAA;;EAEA;EACAC,EAAAA,OAAOA,GAAG;EACRH,IAAAA,IAAI,CAACI,MAAM,CAAC,IAAI,CAACP,QAAQ,EAAE,IAAI,CAACJ,WAAW,CAACS,QAAQ,CAAC;EACrDG,IAAAA,YAAY,CAACC,GAAG,CAAC,IAAI,CAACT,QAAQ,EAAE,IAAI,CAACJ,WAAW,CAACc,SAAS,CAAC;MAE3D,KAAK,MAAMC,YAAY,IAAIC,MAAM,CAACC,mBAAmB,CAAC,IAAI,CAAC,EAAE;EAC3D,MAAA,IAAI,CAACF,YAAY,CAAC,GAAG,IAAI;EAC3B,IAAA;EACF,EAAA;;EAEA;IACAG,cAAcA,CAACC,QAAQ,EAAElB,OAAO,EAAEmB,UAAU,GAAG,IAAI,EAAE;EACnDC,IAAAA,+BAAsB,CAACF,QAAQ,EAAElB,OAAO,EAAEmB,UAAU,CAAC;EACvD,EAAA;IAEAd,UAAUA,CAACJ,MAAM,EAAE;MACjBA,MAAM,GAAG,IAAI,CAACoB,eAAe,CAACpB,MAAM,EAAE,IAAI,CAACE,QAAQ,CAAC;EACpDF,IAAAA,MAAM,GAAG,IAAI,CAACqB,iBAAiB,CAACrB,MAAM,CAAC;EACvC,IAAA,IAAI,CAACsB,gBAAgB,CAACtB,MAAM,CAAC;EAC7B,IAAA,OAAOA,MAAM;EACf,EAAA;;EAEA;IACA,OAAOuB,WAAWA,CAACxB,OAAO,EAAE;EAC1B,IAAA,OAAOM,IAAI,CAACmB,GAAG,CAACvB,mBAAU,CAACF,OAAO,CAAC,EAAE,IAAI,CAACQ,QAAQ,CAAC;EACrD,EAAA;IAEA,OAAOkB,mBAAmBA,CAAC1B,OAAO,EAAEC,MAAM,GAAG,EAAE,EAAE;MAC/C,OAAO,IAAI,CAACuB,WAAW,CAACxB,OAAO,CAAC,IAAI,IAAI,IAAI,CAACA,OAAO,EAAE,OAAOC,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAG,IAAI,CAAC;EACnG,EAAA;IAEA,WAAWL,OAAOA,GAAG;EACnB,IAAA,OAAOA,OAAO;EAChB,EAAA;IAEA,WAAWY,QAAQA,GAAG;EACpB,IAAA,OAAO,CAAA,OAAA,EAAU,IAAI,CAACmB,IAAI,CAAA,CAAE;EAC9B,EAAA;IAEA,WAAWd,SAASA,GAAG;EACrB,IAAA,OAAO,CAAA,CAAA,EAAI,IAAI,CAACL,QAAQ,CAAA,CAAE;EAC5B,EAAA;IAEA,OAAOoB,SAASA,CAACC,IAAI,EAAE;EACrB,IAAA,OAAO,GAAGA,IAAI,CAAA,EAAG,IAAI,CAAChB,SAAS,CAAA,CAAE;EACnC,EAAA;EACF;;;;;;;;"}
|
package/js/dist/button.js
CHANGED
package/js/dist/carousel.js
CHANGED
package/js/dist/collapse.js
CHANGED
package/js/dist/dom/data.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* CoreUI selector-engine.js v5.4.
|
|
2
|
+
* CoreUI selector-engine.js v5.4.3 (https://coreui.io)
|
|
3
3
|
* Copyright 2025 The CoreUI Team (https://github.com/orgs/coreui/people)
|
|
4
4
|
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
|
|
5
5
|
*/
|
package/js/dist/dropdown.js
CHANGED
package/js/dist/modal.js
CHANGED
package/js/dist/navigation.js
CHANGED
package/js/dist/offcanvas.js
CHANGED
package/js/dist/popover.js
CHANGED
package/js/dist/scrollspy.js
CHANGED
package/js/dist/sidebar.js
CHANGED
package/js/dist/tab.js
CHANGED
package/js/dist/toast.js
CHANGED
package/js/dist/tooltip.js
CHANGED
package/js/dist/util/backdrop.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* CoreUI component-functions.js v5.4.
|
|
2
|
+
* CoreUI component-functions.js v5.4.3 (https://coreui.io)
|
|
3
3
|
* Copyright 2025 The CoreUI Team (https://github.com/orgs/coreui/people)
|
|
4
4
|
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
|
|
5
5
|
*/
|
package/js/dist/util/config.js
CHANGED
package/js/dist/util/index.js
CHANGED
package/js/dist/util/swipe.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* CoreUI template-factory.js v5.4.
|
|
2
|
+
* CoreUI template-factory.js v5.4.3 (https://coreui.io)
|
|
3
3
|
* Copyright 2025 The CoreUI Team (https://github.com/orgs/coreui/people)
|
|
4
4
|
* Licensed under MIT (https://github.com/coreui/coreui/blob/main/LICENSE)
|
|
5
5
|
*/
|
package/js/src/base-component.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreui/coreui",
|
|
3
3
|
"description": "The most popular front-end framework for developing responsive, mobile-first projects on the web rewritten and maintained by the CoreUI Team",
|
|
4
|
-
"version": "5.4.
|
|
4
|
+
"version": "5.4.3",
|
|
5
5
|
"config": {
|
|
6
6
|
"version_short": "5.4"
|
|
7
7
|
},
|
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
"@babel/core": "^7.28.3",
|
|
105
105
|
"@babel/preset-env": "^7.28.3",
|
|
106
106
|
"@docsearch/js": "^3.9.0",
|
|
107
|
-
"@eslint/markdown": "^7.
|
|
107
|
+
"@eslint/markdown": "^7.2.0",
|
|
108
108
|
"@popperjs/core": "^2.11.8",
|
|
109
109
|
"@rollup/plugin-babel": "^6.0.4",
|
|
110
110
|
"@rollup/plugin-commonjs": "^28.0.6",
|
|
@@ -112,13 +112,13 @@
|
|
|
112
112
|
"@rollup/plugin-replace": "^6.0.2",
|
|
113
113
|
"@stackblitz/sdk": "^1.11.0",
|
|
114
114
|
"autoprefixer": "^10.4.21",
|
|
115
|
-
"bootstrap": "^5.3.
|
|
115
|
+
"bootstrap": "^5.3.8",
|
|
116
116
|
"bundlewatch": "^0.4.1",
|
|
117
117
|
"clean-css-cli": "^5.6.3",
|
|
118
118
|
"clipboard": "^2.0.11",
|
|
119
119
|
"cross-env": "^10.0.0",
|
|
120
|
-
"eslint": "^9.
|
|
121
|
-
"eslint-config-xo": "0.
|
|
120
|
+
"eslint": "^9.34.0",
|
|
121
|
+
"eslint-config-xo": "0.49.0",
|
|
122
122
|
"eslint-plugin-html": "^8.1.3",
|
|
123
123
|
"eslint-plugin-import": "^2.32.0",
|
|
124
124
|
"eslint-plugin-unicorn": "^60.0.0",
|
|
@@ -127,9 +127,9 @@
|
|
|
127
127
|
"globby": "^14.1.0",
|
|
128
128
|
"hammer-simulator": "0.0.1",
|
|
129
129
|
"html-entities": "^2.6.0",
|
|
130
|
-
"hugo-bin": "^0.
|
|
130
|
+
"hugo-bin": "^0.146.0",
|
|
131
131
|
"ip": "^2.0.1",
|
|
132
|
-
"jasmine": "^5.
|
|
132
|
+
"jasmine": "^5.10.0",
|
|
133
133
|
"jquery": "^3.7.1",
|
|
134
134
|
"karma": "^6.4.4",
|
|
135
135
|
"karma-browserstack-launcher": "1.6.0",
|
|
@@ -146,9 +146,9 @@
|
|
|
146
146
|
"postcss": "^8.5.6",
|
|
147
147
|
"postcss-cli": "^11.0.1",
|
|
148
148
|
"postcss-combine-duplicated-selectors": "^10.0.3",
|
|
149
|
-
"rollup": "^4.
|
|
149
|
+
"rollup": "^4.50.0",
|
|
150
150
|
"rollup-plugin-istanbul": "^5.0.0",
|
|
151
|
-
"sass-embedded": "^1.
|
|
151
|
+
"sass-embedded": "^1.91.0",
|
|
152
152
|
"sass-true": "^9.0.0",
|
|
153
153
|
"shelljs": "^0.10.0",
|
|
154
154
|
"stylelint": "^16.23.1",
|
package/scss/_banner.scss
CHANGED
package/scss/_reboot.scss
CHANGED
|
@@ -537,6 +537,12 @@ legend {
|
|
|
537
537
|
[type="search"] {
|
|
538
538
|
-webkit-appearance: textfield; // 1
|
|
539
539
|
outline-offset: -2px; // 2
|
|
540
|
+
|
|
541
|
+
// 3. Better affordance and consistent appearance for search cancel button
|
|
542
|
+
&::-webkit-search-cancel-button {
|
|
543
|
+
cursor: pointer;
|
|
544
|
+
filter: grayscale(1);
|
|
545
|
+
}
|
|
540
546
|
}
|
|
541
547
|
|
|
542
548
|
// 1. A few input types should stay LTR
|
package/scss/_spinners.scss
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
@each $color in $foregrounds {
|
|
11
11
|
$contrast-ratio: contrast-ratio($background, $color);
|
|
12
|
-
@if $contrast-ratio
|
|
12
|
+
@if $contrast-ratio >= $min-contrast-ratio {
|
|
13
13
|
@return $color;
|
|
14
14
|
} @else if $contrast-ratio > $max-ratio {
|
|
15
15
|
$max-ratio: $contrast-ratio;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
@each $color in $foregrounds {
|
|
14
14
|
$contrast-ratio: contrast-ratio($background, $color);
|
|
15
|
-
@if $contrast-ratio
|
|
15
|
+
@if $contrast-ratio >= $min-contrast-ratio {
|
|
16
16
|
@return $color;
|
|
17
17
|
} @else if $contrast-ratio > $max-ratio {
|
|
18
18
|
$max-ratio: $contrast-ratio;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
@use "sass:color";
|
|
2
|
+
@use "sass:list";
|
|
2
3
|
@use "sass:map";
|
|
3
4
|
@use "sass:math";
|
|
4
|
-
|
|
5
|
+
|
|
6
|
+
// A list of pre-calculated numbers of pow(divide((divide($value, 255) + .055), 1.055), 2.4). (from 0 to 255)
|
|
7
|
+
// stylelint-disable-next-line scss/dollar-variable-default, scss/dollar-variable-pattern
|
|
8
|
+
$_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003 .0033 .0037 .004 .0044 .0048 .0052 .0056 .006 .0065 .007 .0075 .008 .0086 .0091 .0097 .0103 .011 .0116 .0123 .013 .0137 .0144 .0152 .016 .0168 .0176 .0185 .0194 .0203 .0212 .0222 .0232 .0242 .0252 .0262 .0273 .0284 .0296 .0307 .0319 .0331 .0343 .0356 .0369 .0382 .0395 .0409 .0423 .0437 .0452 .0467 .0482 .0497 .0513 .0529 .0545 .0561 .0578 .0595 .0612 .063 .0648 .0666 .0685 .0704 .0723 .0742 .0762 .0782 .0802 .0823 .0844 .0865 .0887 .0908 .0931 .0953 .0976 .0999 .1022 .1046 .107 .1095 .1119 .1144 .117 .1195 .1221 .1248 .1274 .1301 .1329 .1356 .1384 .1413 .1441 .147 .15 .1529 .1559 .159 .162 .1651 .1683 .1714 .1746 .1779 .1812 .1845 .1878 .1912 .1946 .1981 .2016 .2051 .2086 .2122 .2159 .2195 .2232 .227 .2307 .2346 .2384 .2423 .2462 .2502 .2542 .2582 .2623 .2664 .2705 .2747 .2789 .2831 .2874 .2918 .2961 .3005 .305 .3095 .314 .3185 .3231 .3278 .3325 .3372 .3419 .3467 .3515 .3564 .3613 .3663 .3712 .3763 .3813 .3864 .3916 .3968 .402 .4072 .4125 .4179 .4233 .4287 .4342 .4397 .4452 .4508 .4564 .4621 .4678 .4735 .4793 .4851 .491 .4969 .5029 .5089 .5149 .521 .5271 .5333 .5395 .5457 .552 .5583 .5647 .5711 .5776 .5841 .5906 .5972 .6038 .6105 .6172 .624 .6308 .6376 .6445 .6514 .6584 .6654 .6724 .6795 .6867 .6939 .7011 .7084 .7157 .7231 .7305 .7379 .7454 .7529 .7605 .7682 .7758 .7835 .7913 .7991 .807 .8148 .8228 .8308 .8388 .8469 .855 .8632 .8714 .8796 .8879 .8963 .9047 .9131 .9216 .9301 .9387 .9473 .956 .9647 .9734 .9823 .9911 1;
|
|
5
9
|
|
|
6
10
|
@function contrast-ratio($background, $foreground) {
|
|
7
11
|
$l1: luminance($background);
|
|
8
12
|
$l2: luminance(opaque($background, $foreground));
|
|
9
13
|
|
|
10
|
-
@return if($l1 > $l2,
|
|
14
|
+
@return if($l1 > $l2, math.div($l1 + .05, $l2 + .05), math.div($l2 + .05, $l1 + .05));
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
// Return WCAG2.2 relative luminance
|
|
@@ -15,13 +19,13 @@
|
|
|
15
19
|
// See https://www.w3.org/TR/WCAG/#dfn-contrast-ratio
|
|
16
20
|
@function luminance($color) {
|
|
17
21
|
$rgb: (
|
|
18
|
-
"r": color.channel($color, "red"
|
|
19
|
-
"g": color.channel($color, "green"
|
|
20
|
-
"b": color.channel($color, "blue"
|
|
22
|
+
"r": color.channel($color, "red"),
|
|
23
|
+
"g": color.channel($color, "green"),
|
|
24
|
+
"b": color.channel($color, "blue")
|
|
21
25
|
);
|
|
22
26
|
|
|
23
27
|
@each $name, $value in $rgb {
|
|
24
|
-
$value: if(
|
|
28
|
+
$value: if(math.div($value, 255) < .04045, math.div(math.div($value, 255), 12.92), list.nth($_luminance-list, math.round($value + 1)));
|
|
25
29
|
$rgb: map.merge($rgb, ($name: $value));
|
|
26
30
|
}
|
|
27
31
|
|