Conversation
3 tasks
… into 2026-08-24-going-to-palette-town
… into 2026-08-24-going-to-palette-town
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.
About the PR
This PR adds Color serialization from palette colors. These are specified in YAML in the form
<PALETTE_NAME>.<COLOR_NAME>, e.g.Paper.bounty.Palettes are specified in a palette prototype (refer to space-wizards/space-station-14#45826 for examples)
Adds a PaletteManager to handle caching and looking up these values, with a few convenience methods to get a random color out of a particular palette.
If added, could provide an alternative for #7027 where it's used as a content-side palette.
Why / Balance
One of the changes brainstormed from space-wizards/space-station-14#45540.
Being able to reference the same Color from completely different YAML files based on the same palette, without needing anchors or parenting seems useful.
Technical details
Adds a new PaletteManager (placed into Robust.Shared.ColorNaming, name not ideal but still fits). This is registered as a new dependency. PaletteManager holds both a named reference to specific colors (allowing for direct lookup from YAML), and a reference from a palette to an unnamed list of Colors inside.
Adds a PalettePrototype to store named references to Colors (implementation largely taken from SS14's ColorPalettePrototype) with a localized name.
PalettePrototypes serialize with a high priority (arbitrarily set to 1000 to allow lower/higher values). They have a PostDeserialize handler that registers their Colors with the PaletteManager - this currently builds a dictionary as it reads the values on initial serialization (frozen by Initialize), then expects to receive updates on the prototype reload event.
Probably an error - if changes were add/update, but removals were handled by the reload event, probably makes more sense.
Test plan
space-wizards/space-station-14#45540 is a sample of this in use, and a decent sandbox for testing.
Should write a small integration test that adds a known set of colors in two serialization passes, testing the parsed Color values of a test entity prototype - adding a color, changing a color, removing a color.