Skip to content

Commit

Permalink
Rename property key
Browse files Browse the repository at this point in the history
  • Loading branch information
asamuzaK committed Jan 7, 2024
1 parent 33051ed commit 6e9e7d3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/mjs/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -2445,15 +2445,15 @@ export const convertColorMixToHex = (value, opt = {}) => {
* get color in hex color notation
* @param {string} value - value
* @param {object} [opt] - options
* @returns {?string|Array} - hex color or array of [prop, hex] pair
* @returns {?string|Array} - hex color or array of [property, hex] pair
*/
export const getColorInHex = (value, opt = {}) => {
if (isString(value)) {
value = value.trim();
} else {
throw new TypeError(`Expected String but got ${getType(value)}.`);
}
const { alpha, currentColor, prop } = opt;
const { alpha, currentColor, property } = opt;
let hex;
if (/^currentcolor$/i.test(value)) {
if (currentColor) {
Expand Down Expand Up @@ -2490,7 +2490,7 @@ export const getColorInHex = (value, opt = {}) => {
currentColor
});
}
return prop ? [prop, hex] : (hex || null);
return property ? [property, hex] : (hex || null);
};

/**
Expand Down
4 changes: 2 additions & 2 deletions src/mjs/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ export const getCurrentThemeBaseValues = async (opt = {}) => {
}
}
func.push(getColorInHex(value, {
prop: key,
property: key,
alpha: true
}));
}
Expand All @@ -544,7 +544,7 @@ export const getCurrentThemeBaseValues = async (opt = {}) => {
const value = values.get(key);
if (value.startsWith('color-mix')) {
func.push(getColorInHex(value, {
prop: key
property: key
}));
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/color.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7391,7 +7391,7 @@ describe('color', () => {
it('should get array', () => {
const res = func('color-mix(in srgb, blue, red)', {
alpha: true,
prop: 'foo'
property: 'foo'
});
const value = mjs.convertColorToHex('rgb(128, 0, 128)');
assert.deepEqual(res, ['foo', value], 'result');
Expand Down

0 comments on commit 6e9e7d3

Please sign in to comment.