fix: refine scratch block category styles - #1568
Open
maxelkins wants to merge 5 commits into
Open
Conversation
Adds --scratch-* CSS custom properties for each Scratch block category (and a prefers-contrast: more variant), sourced from scratch-gui's colour-mode tokens, ready to be wired into the instructions styles. Pulled from the discovery prototype on experience-cs-instructions-prototype (RaspberryPiFoundation/digital-editor-issues#1687).
Swaps the hardcoded hex background colours on the block category classes for the new --scratch-* custom properties, and adds a prefers-contrast: more override so the category text stays legible against the higher-contrast background colours. Pulled from the discovery prototype on experience-cs-instructions-prototype (RaspberryPiFoundation/digital-editor-issues#1687).
Uses the --space-0-25/--space-0-5 tokens for the inline code padding instead of a one-off calc() derived from a spacing token, matching the rest of the design system's spacing scale.
maxelkins
temporarily deployed
to
previews/1568/merge
August 3, 2026 15:31 — with
GitHub Actions
Inactive
maxelkins
marked this pull request as ready for review
August 3, 2026 16:14
maxelkins
temporarily deployed
to
previews/1568/merge
August 3, 2026 16:14 — with
GitHub Actions
Inactive
maxelkins
commented
Aug 3, 2026
maxelkins
marked this pull request as draft
August 3, 2026 16:54
Contributor
Author
|
Putting back to draft for a sec while I tweak something... |
maxelkins
marked this pull request as ready for review
August 4, 2026 11:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes https://github.com/RaspberryPiFoundation/digital-editor-issues/issues/1687
Summary
Add Scratch block category colours as CSS custom properties, uses them and update the code style (used for the highlighted text).
Pulled from the discovery prototype on
experience-cs-instructions-prototype(RaspberryPiFoundation/digital-editor-issues#1687).Changes
--scratch-*custom propertiesAdds the Scratch block category colours in instructions from
--scratch-*CSS custom properties instead of hardcoded hex values.High contrast details
Scratch has an option to turn on high contrast block colours. This is enabled when the users OS preference is set to
prefers-contrast: more. It normally can also be turn on in the Scratch settings UI (which we don't have).So to make sure that the colours in the instructions match the blocks when
prefers-contrast: moreis true, I've also added support of the high contrast colours in the instructions when the preference is set.Code styles
Also tidies the inline code snippet padding to use the design system's spacing tokens.
Now uses the
--space-0-25/--space-0-5tokensNotes
--scratch-*custom properties currently scoped to the instructions panel, but could be moved in future if needed elsewhere.Viewing these changes
Enable editable instructions in the preview:
Code element padding changes can be seen by adding a code snippet to the user editable (teacher) instructions.
Currently the Scratch colours can only been seen in 2 ways
Screenshots
Code style refinement:
Categories:
Categories (high contrast):
Non-editable instructions demo (like Code Club Projects)
Demo code used