feat: Add support for color themes in theme creation

This commit modifies the theme creation process to include support for color themes. It adds a new checkbox field in the theme creation form to indicate whether the theme is a color theme. If the checkbox is selected, the CSS styles for the theme should be provided as a JSON object with the color values. Additionally, the `create-theme.yml` workflow file is updated to include the `THEME_IS_COLOR_THEME` environment variable when building the theme. The `rebuild-themes.py` script is also updated to generate a `chrome.css` file for color themes based on the provided color values in a `colors.json` file.

Fixes #69
This commit is contained in:
Mauro Balades 2024-08-21 16:31:16 +02:00
parent 6aa221874d
commit 01040237ed
4 changed files with 57 additions and 4 deletions

View file

@ -33,17 +33,29 @@ body:
placeholder: https://...
validations:
required: true
- type: checkbox
id: is-color-theme
attributes:
label: Is Color Theme
description: Check this box if the theme is a color theme.
- type: textarea
id: styles
attributes:
label: Theme Styles
render: css
description: The CSS styles for the theme.
description: The CSS styles for the theme. If the theme is a color theme, the styles should be a JSON object with the color values.
placeholder: |
body {
background-color: white;
color: black;
}
or
{
"primaryColor": "#000000",
...
}
validations:
required: true
- type: textarea
@ -59,7 +71,7 @@ body:
attributes:
render: json
label: Preferences
description: The preferences for the theme in JSON format. Leave empty if there are no preferences.
description: The preferences for the theme in JSON format. Leave empty if there are no preferences. This is not used for color themes.
placeholder: |
{
"uc.my-preference.enable-this": "Enable this feature for the theme",

View file

@ -38,6 +38,7 @@ jobs:
echo "THEME_HOMEPAGE=${{ fromJson(steps.issue-parser.outputs.jsonString)['homepage'] }}" >> $GITHUB_ENV
echo "THEME_IMAGE=${{ fromJson(steps.issue-parser.outputs.jsonString)['image'] }}" >> $GITHUB_ENV
echo "THEME_AUTHOR=${{ github.event.issue.user.login }}" >> $GITHUB_ENV
echo "THEME_IS_COLOR_THEME=${{ fromJson(steps.issue-parser.outputs.jsonString)['is-color-theme'] }}" >> $GITHUB_ENV
- name: Write styles to file
uses: "DamianReeves/write-file-action@master"
@ -70,6 +71,7 @@ jobs:
--description "${{ env.THEME_DESCRIPTION }}" \
--author "${{ env.THEME_AUTHOR }}" \
--image "${{ env.THEME_IMAGE }}" \
--is-color-theme "${{ env.THEME_IS_COLOR_THEME }}" \
--homepage "${{ env.THEME_HOMEPAGE }}" 2> error.log
- name: Export creation output