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

Commitf8aa2db

Browse files
authored
ci(theme preview): allow gradient themes (anuraghazra#3400)
1 parentedeebeb commitf8aa2db

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

‎scripts/preview-theme.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Hjson from "hjson";
1212
importsnakeCasefrom"lodash.snakecase";
1313
importparsefrom"parse-diff";
1414
import{inspect}from"util";
15-
import{isValidHexColor}from"../src/common/utils.js";
15+
import{isValidHexColor,isValidGradient}from"../src/common/utils.js";
1616
import{themes}from"../themes/index.js";
1717
import{getGithubToken,getRepoInfo}from"./helpers.js";
1818

@@ -42,7 +42,7 @@ const COLOR_PROPS = {
4242
title_color:6,
4343
icon_color:6,
4444
text_color:6,
45-
bg_color:8,
45+
bg_color:23,
4646
border_color:6,
4747
};
4848
constACCEPTED_COLOR_PROPS=Object.keys(COLOR_PROPS);
@@ -499,7 +499,13 @@ export const run = async () => {
499499
`Theme color property \`${colorKey}\` can not be longer than \`${COLOR_PROPS[colorKey]}\` characters`,
500500
);
501501
invalidColors=true;
502-
}elseif(!isValidHexColor(colorValue)){
502+
}elseif(
503+
!isValidHexColor(colorValue)||
504+
!(
505+
colorKey==="bg_color"&&
506+
isValidGradient(colorValue.split(","))
507+
)
508+
){
503509
errors.push(
504510
`Theme color property \`${colorKey}\` is not a valid hex color: <code>#${colorValue}</code>`,
505511
);

‎src/common/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ const clampValue = (number, min, max) => {
245245
*@returns {boolean} True if the given string is a valid gradient.
246246
*/
247247
constisValidGradient=(colors)=>{
248-
returnisValidHexColor(colors[1])&&isValidHexColor(colors[2]);
248+
returncolors.slice(1).every((color)=>isValidHexColor(color));
249249
};
250250

251251
/**

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp