playcanvas / playcanvas/pcui

Combine themes into single CSS file

Open
#477 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
793
Forks
97
PR merge metrics
No merged PRs in 30d

Description

Currently, we have a green and grey theme. These are shipped as two .scss files. And if you want to simply import the styles, you can only use the green theme.

It would be great if we incorporated themes into the CSS and made them switchable at runtime. We can use CSS variables for this:

/* Default theme (no data-theme set) */
:root {
  --bg: #ffffff;
  --fg: #111111;
  --accent: #0066ff;
}

/* Green theme */
:root[data-theme="green"] {
  --bg: #e9f6e9;
  --fg: #0b280b;
  --accent: #24a726;
}

/* Grey theme */
:root[data-theme="grey"] {
  --bg: #e6e6e6;
  --fg: #1a1a1a;
  --accent: #7a7a7a;
}

You can then set a theme with JS:

document.documentElement.setAttribute('data-theme', 'grey');

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the two shipped .scss theme files and the import path that currently exposes only the green theme. Review how their color values are used, then determine how one combined CSS output can expose the default, green, and grey states through the proposed data-theme attribute. Done means both themes remain available and can be switched at runtime.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, scss
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.