Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0691084

Browse files
authored
ci(preview theme): allow gradient colors (2) (anuraghazra#3427)
1 parent87a3bf3 commit0691084

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

‎scripts/preview-theme.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -500,14 +500,12 @@ export const run = async () => {
500500
);
501501
invalidColors=true;
502502
}elseif(
503-
!isValidHexColor(colorValue)||
504-
!(
505-
colorKey==="bg_color"&&
506-
isValidGradient(colorValue.split(","))
507-
)
503+
!(colorKey==="bg_color"&&colorValue.split(",").length>1
504+
?isValidGradient(colorValue.split(","))
505+
:isValidHexColor(colorValue))
508506
){
509507
errors.push(
510-
`Theme color property \`${colorKey}\` is not a valid hex color: <code>#${colorValue}</code>`,
508+
`Theme color property \`${colorKey}\` is not a valid hex color: <code>${colorValue}</code>`,
511509
);
512510
invalidColors=true;
513511
}
@@ -548,6 +546,10 @@ export const run = async () => {
548546
Object.keys(colorPairs).forEach((item)=>{
549547
letcolor1=colorPairs[item][0];
550548
letcolor2=colorPairs[item][1];
549+
constisGradientColor=color2.split(",").length>1;
550+
if(isGradientColor){
551+
return;
552+
}
551553
color1=color1.length===4 ?color1.slice(0,3) :color1.slice(0,6);
552554
color2=color2.length===4 ?color2.slice(0,3) :color2.slice(0,6);
553555
if(!ccc.isLevelAA(`#${color1}`,`#${color2}`)){

‎src/common/utils.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,10 @@ const clampValue = (number, min, max) => {
245245
*@returns {boolean} True if the given string is a valid gradient.
246246
*/
247247
constisValidGradient=(colors)=>{
248-
returncolors.slice(1).every((color)=>isValidHexColor(color));
248+
return(
249+
colors.length>2&&
250+
colors.slice(1).every((color)=>isValidHexColor(color))
251+
);
249252
};
250253

251254
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp