Skip to content

Repository files navigation

TestTheme2

Standalone IITC theme selector and CSS injector.

This repo builds a userscript that works without any runtime dependencies:

  • no iitcpluginkit
  • no iitc-kuku-helper-handlebars
  • no iitc-theme-chooser

UI behavior

Inside IITC, click the TestTheme2 toolbox button.

The settings window shows:

  • a hello description at the top
  • theme preview cards on the left
  • each preview is displayed at 250×166 px
  • the theme title is shown under each preview
  • Default, which turns off all injected CSS and options
  • per-theme variants on the right
  • per-theme options on the right
  • global options on the right

Theme folders

Every folder in themes/ is automatically compiled as a selectable theme.

themes/
  my-theme/
    theme.json
    preview.svg
    base.css
    variants/
      light.css
      dark.css
    options/
      blur.css
      compact.css

Required:

  • base.css

Optional:

  • theme.json
  • preview.svg, preview.png, preview.jpg, preview.jpeg, or preview.webp
  • variants/*.css
  • options/*.css

Special global imports

Use this file for CSS @import rules:

global-imports.css

The contents of global-imports.css are always placed at the very top of the injected CSS whenever anything other than Default is selected. This keeps @import rules valid.

Global options

Global options go in:

global-options/
  blur.css
  rounded-panels.css

These are available no matter which non-default theme is selected.

Add a new theme

Create:

themes/my-new-theme/base.css

Optionally add:

themes/my-new-theme/theme.json
themes/my-new-theme/preview.svg
themes/my-new-theme/variants/light.css
themes/my-new-theme/variants/dark.css
themes/my-new-theme/options/blur.css

GitHub Actions will automatically discover and compile it on push.

Local build

Use Node.js 24 or newer. CI uses Node.js 24 LTS.

npm run build

The generated userscript appears in dist/.

Run the regression checks with npm test. They cover the generated userscript, settings recovery, scheduled variants, Live CSS, and build validation.

Runtime JavaScript lives in src/runtime.js. The build embeds that function and the compiled configuration into the standalone userscript without a bundler.

Release versions use the numeric major.minor.patch version from package.json followed by the UTC build date, time, and milliseconds. For example, 0.1.0.20260910.120000.123. Development versions add .dev. Later builds of the same base version therefore receive newer update versions without Git tags. Keep the base version nondecreasing when publishing updates.

Missing required files and invalid JSON fail the build. Optional metadata may be omitted, but existing metadata files must contain valid JSON objects. Auto-variant configuration must reference existing variants and use valid times.

GitHub Pages

Enable Pages:

Settings → Pages → Build and deployment → Source: GitHub Actions

After every push to main, the workflow builds and deploys:

/files/release/iitc_plugin_TestTheme2.user.js
/files/release/iitc_plugin_TestTheme2.meta.js

About

Test

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages