From 66c4494ed8a94a0282fdccfbdd30bf1a331cdd11 Mon Sep 17 00:00:00 2001 From: YangFong Date: Sat, 24 Aug 2024 22:57:07 +0800 Subject: [PATCH 1/2] chore: add more color options --- src/config/style.ts | 53 +++++++++++++++++++++++++++++++-------------- src/types/index.ts | 5 +++++ 2 files changed, 42 insertions(+), 16 deletions(-) create mode 100644 src/types/index.ts diff --git a/src/config/style.ts b/src/config/style.ts index 747a4c07e..ea012b88a 100644 --- a/src/config/style.ts +++ b/src/config/style.ts @@ -1,4 +1,6 @@ -export const fontFamilyOptions = [ +import type { IConfigOption } from '@/types' + +export const fontFamilyOptions: IConfigOption[] = [ { label: `无衬线`, value: `-apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif`, @@ -16,7 +18,7 @@ export const fontFamilyOptions = [ }, ] -export const fontSizeOptions = [ +export const fontSizeOptions: IConfigOption[] = [ { label: `12px`, value: `12px`, @@ -44,22 +46,42 @@ export const fontSizeOptions = [ }, ] -export const colorOptions = [ +export const colorOptions: IConfigOption[] = [ { label: `经典蓝`, - value: `rgba(15, 76, 129, 1)`, + value: `#0f4c81`, desc: `最新流行`, }, { label: `翡翠绿`, - value: `rgba(0, 152, 116, 1)`, + value: `#009874`, desc: `优雅清新`, }, { label: `活力橘`, - value: `rgba(250, 81, 81, 1)`, + value: `#fa5151`, desc: `热情活泼`, }, + { + label: `柠檬黄`, + value: `#FECE00`, + desc: `明亮温暖`, + }, + { + label: `樱桃红`, + value: `#FF445F`, + desc: `浪漫热情`, + }, + { + label: `浅紫色`, + value: `#92617E`, + desc: `优雅高贵`, + }, + { + label: `天空蓝`, + value: `#55C9EA`, + desc: `清新脱俗`, + }, // { label: `微信绿`, value: `rgb(26, 173, 25,1)`, desc: `经典微信绿` }, ] @@ -140,16 +162,15 @@ const codeBlockThemeList = [ `xt256.min.css`, ].sort() -export const codeBlockThemeOptions = [ - ...codeBlockThemeList.map((codeBlockTheme) => { - const url = `${codeBlockUrlPrefix}${codeBlockTheme}` - const label = codeBlockTheme.replace(`.min.css`, ``) - return { - label, - value: url, - } - }), -] +export const codeBlockThemeOptions: IConfigOption[] = codeBlockThemeList.map((codeBlockTheme) => { + const url = `${codeBlockUrlPrefix}${codeBlockTheme}` + const label = codeBlockTheme.replace(`.min.css`, ``) + return { + label, + value: url, + desc: ``, + } +}) export const legendOptions = [ { diff --git a/src/types/index.ts b/src/types/index.ts new file mode 100644 index 000000000..769edc446 --- /dev/null +++ b/src/types/index.ts @@ -0,0 +1,5 @@ +export interface IConfigOption { + label: string + value: string + desc: string +} From 11c66bfecaa934d9acafedd8d1c37f2ec08416c9 Mon Sep 17 00:00:00 2001 From: Libin YANG Date: Sat, 24 Aug 2024 23:34:14 +0800 Subject: [PATCH 2/2] Update style.ts --- src/config/style.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/config/style.ts b/src/config/style.ts index ea012b88a..ee6061026 100644 --- a/src/config/style.ts +++ b/src/config/style.ts @@ -49,7 +49,7 @@ export const fontSizeOptions: IConfigOption[] = [ export const colorOptions: IConfigOption[] = [ { label: `经典蓝`, - value: `#0f4c81`, + value: `#0F4C81`, desc: `最新流行`, }, { @@ -59,7 +59,7 @@ export const colorOptions: IConfigOption[] = [ }, { label: `活力橘`, - value: `#fa5151`, + value: `#FA5151`, desc: `热情活泼`, }, { @@ -82,7 +82,6 @@ export const colorOptions: IConfigOption[] = [ value: `#55C9EA`, desc: `清新脱俗`, }, - // { label: `微信绿`, value: `rgb(26, 173, 25,1)`, desc: `经典微信绿` }, ] const codeBlockUrlPrefix = `https://cdn.bootcdn.net/ajax/libs/highlight.js/11.10.0/styles/` @@ -163,11 +162,11 @@ const codeBlockThemeList = [ ].sort() export const codeBlockThemeOptions: IConfigOption[] = codeBlockThemeList.map((codeBlockTheme) => { - const url = `${codeBlockUrlPrefix}${codeBlockTheme}` const label = codeBlockTheme.replace(`.min.css`, ``) + const value = `${codeBlockUrlPrefix}${codeBlockTheme}` return { label, - value: url, + value, desc: ``, } })