Skip to content

Commit

Permalink
feat: add theme to skin
Browse files Browse the repository at this point in the history
  • Loading branch information
wa0x6e committed Jan 13, 2025
1 parent ef0aa8a commit 59151f0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/graphql/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ const SKIN_SETTINGS = [
'border_color',
'heading_color',
'header_color',
'primary_color'
'primary_color',
'theme'
];

export function checkLimits(args: any = {}, type) {
Expand Down Expand Up @@ -73,10 +74,12 @@ export function checkLimits(args: any = {}, type) {
}

function formatSkinSettings(result) {
return SKIN_SETTINGS.reduce((acc, color) => {
if (!result[color]) return acc;
return SKIN_SETTINGS.reduce((acc, colorName) => {
if (!result[colorName]) return acc;

acc[color] = `#${result[color]}`;
acc[colorName] = `${colorName.includes('_color') ? '#' : ''}${
result[colorName]
}`;
return acc;
}, {});
}
Expand Down
1 change: 1 addition & 0 deletions src/graphql/schema.gql
Original file line number Diff line number Diff line change
Expand Up @@ -662,4 +662,5 @@ type SkinSettings {
heading_color: String
header_color: String
primary_color: String
theme: String
}
1 change: 1 addition & 0 deletions src/helpers/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -202,5 +202,6 @@ CREATE TABLE skins (
heading_color VARCHAR(6) DEFAULT NULL,
primary_color VARCHAR(6) DEFAULT NULL,
header_color VARCHAR(6) DEFAULT NULL,
theme VARCHAR(5) NOT NULL DEFAULT 'light',
PRIMARY KEY (id)
);

0 comments on commit 59151f0

Please sign in to comment.