Class TextModeColorDefaults
TextMode-owned palette factory. Declares the entry names and semantic roles that make up a TextMode theme, resolves a theme by name through Scylla.Core.Util.Palette.ColorAssetRegistry, and carries the one hard-coded palette the module falls back to when nothing suitable is found.
Inherited Members
Namespace: Scylla.TextMode
Assembly: ScyllaTextMode.dll
Syntax
public static class TextModeColorDefaults
Remarks
A theme palette carries two groups of entries in one asset. The first sixteen are the ANSI colors, in ANSI order, which is what lets the same asset drive SetPalette(ColorPalette): indexed text is looked up by position, so their order is the contract and their names are only there to make the asset readable. Every entry after those is semantic, looked up by name, and annotated with a Scylla.Core.Util.Palette.ColorRole so a palette editor can show what each color is for.
Five palettes ship with the module as assets under Resources/Color/Palettes/.
They are discovered by the registry like any other palette, so a palette of the same
name placed anywhere in the project replaces the shipped one, and a palette tagged
TAG_TEXTMODE becomes a selectable theme without any code change.
Only the classic theme has a body here. The other four exist purely as assets; their color tables live in the editor assembly, which is what generates the asset files.
Fields
ANSI_COLOR_COUNT
Number of ANSI colors a theme palette must lead with, in ANSI order.
Declaration
public const int ANSI_COLOR_COUNT = 16
Field Value
| Type | Description |
|---|---|
| int |
DESCRIPTION_CLASSIC
Description carried by the hard-coded classic palette.
Declaration
public const string DESCRIPTION_CLASSIC = "Light gray on black with the standard ANSI sixteen. The default TextMode theme."
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_ACCENT
Entry name of the highlight color.
Declaration
public const string ENTRY_ACCENT = "Accent"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_BACKGROUND
Entry name of the default cell background.
Declaration
public const string ENTRY_BACKGROUND = "Background"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_BLACK
Entry name of ANSI color 0.
Declaration
public const string ENTRY_BLACK = "Black"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_BLUE
Entry name of ANSI color 4.
Declaration
public const string ENTRY_BLUE = "Blue"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_BORDER
Entry name of the frame and separator color.
Declaration
public const string ENTRY_BORDER = "Border"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_BRIGHT_BLACK
Entry name of ANSI color 8.
Declaration
public const string ENTRY_BRIGHT_BLACK = "BrightBlack"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_BRIGHT_BLUE
Entry name of ANSI color 12.
Declaration
public const string ENTRY_BRIGHT_BLUE = "BrightBlue"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_BRIGHT_CYAN
Entry name of ANSI color 14.
Declaration
public const string ENTRY_BRIGHT_CYAN = "BrightCyan"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_BRIGHT_FOREGROUND
Entry name of the emphasized text color.
Declaration
public const string ENTRY_BRIGHT_FOREGROUND = "BrightForeground"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_BRIGHT_GREEN
Entry name of ANSI color 10.
Declaration
public const string ENTRY_BRIGHT_GREEN = "BrightGreen"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_BRIGHT_MAGENTA
Entry name of ANSI color 13.
Declaration
public const string ENTRY_BRIGHT_MAGENTA = "BrightMagenta"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_BRIGHT_RED
Entry name of ANSI color 9.
Declaration
public const string ENTRY_BRIGHT_RED = "BrightRed"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_BRIGHT_WHITE
Entry name of ANSI color 15.
Declaration
public const string ENTRY_BRIGHT_WHITE = "BrightWhite"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_BRIGHT_YELLOW
Entry name of ANSI color 11.
Declaration
public const string ENTRY_BRIGHT_YELLOW = "BrightYellow"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_CURSOR
Entry name of the text cursor color.
Declaration
public const string ENTRY_CURSOR = "Cursor"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_CYAN
Entry name of ANSI color 6.
Declaration
public const string ENTRY_CYAN = "Cyan"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_DIM_FOREGROUND
Entry name of the secondary text color.
Declaration
public const string ENTRY_DIM_FOREGROUND = "DimForeground"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_ERROR_FOREGROUND
Entry name of the error text color.
Declaration
public const string ENTRY_ERROR_FOREGROUND = "ErrorForeground"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_FOREGROUND
Entry name of the default text color.
Declaration
public const string ENTRY_FOREGROUND = "Foreground"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_GREEN
Entry name of ANSI color 2.
Declaration
public const string ENTRY_GREEN = "Green"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_INFO_FOREGROUND
Entry name of the informational text color.
Declaration
public const string ENTRY_INFO_FOREGROUND = "InfoForeground"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_MAGENTA
Entry name of ANSI color 5.
Declaration
public const string ENTRY_MAGENTA = "Magenta"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_RED
Entry name of ANSI color 1.
Declaration
public const string ENTRY_RED = "Red"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_SELECTION_BACKGROUND
Entry name of the fill color behind a selection.
Declaration
public const string ENTRY_SELECTION_BACKGROUND = "SelectionBackground"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_SELECTION_FOREGROUND
Entry name of the text color inside a selection.
Declaration
public const string ENTRY_SELECTION_FOREGROUND = "SelectionForeground"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_SUCCESS_FOREGROUND
Entry name of the success text color.
Declaration
public const string ENTRY_SUCCESS_FOREGROUND = "SuccessForeground"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_WARNING_FOREGROUND
Entry name of the warning text color.
Declaration
public const string ENTRY_WARNING_FOREGROUND = "WarningForeground"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_WHITE
Entry name of ANSI color 7.
Declaration
public const string ENTRY_WHITE = "White"
Field Value
| Type | Description |
|---|---|
| string |
ENTRY_YELLOW
Entry name of ANSI color 3.
Declaration
public const string ENTRY_YELLOW = "Yellow"
Field Value
| Type | Description |
|---|---|
| string |
NAME_AMBER_PHOSPHOR
Name of the amber phosphor theme, the warmer monochrome variant.
Declaration
public const string NAME_AMBER_PHOSPHOR = "Scylla TextMode Amber Phosphor"
Field Value
| Type | Description |
|---|---|
| string |
NAME_AMIGA
Name of the Amiga theme: white on blue with an orange accent, in the Workbench 1.3 colors.
Declaration
public const string NAME_AMIGA = "Scylla TextMode Amiga"
Field Value
| Type | Description |
|---|---|
| string |
NAME_CLASSIC
Name of the classic theme: light gray on black, the module's original look.
Declaration
public const string NAME_CLASSIC = "Scylla TextMode Classic"
Field Value
| Type | Description |
|---|---|
| string |
NAME_GREEN_PHOSPHOR
Name of the green phosphor theme, after monochrome terminals of the period.
Declaration
public const string NAME_GREEN_PHOSPHOR = "Scylla TextMode Green Phosphor"
Field Value
| Type | Description |
|---|---|
| string |
NAME_LIGHTMAN
Name of the Lightman theme: monochrome pale blue on near-black.
Declaration
public const string NAME_LIGHTMAN = "Scylla TextMode Lightman"
Field Value
| Type | Description |
|---|---|
| string |
NAME_MIDNIGHT
Name of the midnight theme: a cool, low contrast dark scheme.
Declaration
public const string NAME_MIDNIGHT = "Scylla TextMode Midnight"
Field Value
| Type | Description |
|---|---|
| string |
NAME_PAPER
Name of the paper theme, the one light scheme.
Declaration
public const string NAME_PAPER = "Scylla TextMode Paper"
Field Value
| Type | Description |
|---|---|
| string |
NAME_WORDPERFECT
Name of the WordPerfect theme: light gray on blue, in the DOS text mode colors.
Declaration
public const string NAME_WORDPERFECT = "Scylla TextMode WordPerfect"
Field Value
| Type | Description |
|---|---|
| string |
TAG_TEXTMODE
Tag carried by every TextMode theme palette. Selectable themes are found by this tag.
Declaration
public const string TAG_TEXTMODE = "TextMode"
Field Value
| Type | Description |
|---|---|
| string |
Properties
ANSIEntryNames
Gets the sixteen ANSI entry names, in the order a theme palette must declare them.
Declaration
public static ReadOnlySpan<string> ANSIEntryNames { get; }
Property Value
| Type | Description |
|---|---|
| ReadOnlySpan<string> |
BuiltInNames
Gets the names of the five palettes shipped with the module, in cycle order.
Declaration
public static ReadOnlySpan<string> BuiltInNames { get; }
Property Value
| Type | Description |
|---|---|
| ReadOnlySpan<string> |
Remarks
A game that wants every selectable theme, including palettes the project added
itself, should ask the registry for
GetPalettesByTag(TAG_TEXTMODE) instead. This list is
only the set that ships with the module.
Fallback
Gets the hard-coded classic theme. Used when no palette asset can satisfy the request, so a view always has a complete color set to draw with.
Declaration
public static ColorPalette Fallback { get; }
Property Value
| Type | Description |
|---|---|
| ColorPalette |
SemanticEntryNames
Gets the semantic entry names every theme palette must define.
Declaration
public static ReadOnlySpan<string> SemanticEntryNames { get; }
Property Value
| Type | Description |
|---|---|
| ReadOnlySpan<string> |
Methods
CreateClassicColors()
Returns the color table of the classic theme.
Declaration
public static TextModeColorSet CreateClassicColors()
Returns
| Type | Description |
|---|---|
| TextModeColorSet | The classic theme's colors. |
Remarks
The ANSI sixteen are the standard xterm table, and the semantic colors are the values the views carried as serialized defaults before themes existed, so a project that never picks a theme looks exactly as it did.
CreateEntries(in TextModeColorSet)
Builds the palette entries for one TextMode theme, naming and role-tagging each color.
Declaration
public static ColorPaletteEntry[] CreateEntries(in TextModeColorSet colors)
Parameters
| Type | Name | Description |
|---|---|---|
| TextModeColorSet | colors | The theme's colors. |
Returns
| Type | Description |
|---|---|
| ColorPaletteEntry[] | The entries that make up a theme palette, ANSI sixteen first. |
CreateFallback()
Builds the hard-coded classic theme from code.
Declaration
public static ColorPalette CreateFallback()
Returns
| Type | Description |
|---|---|
| ColorPalette | The classic theme palette, tagged TAG_TEXTMODE. |
Remarks
Prefer Fallback, which caches the result. This method is public so the editor-side asset generator can seed the shipped classic palette asset from the same color table the fallback uses.
HasRequiredEntries(ColorPalette)
Checks whether a palette can be used as a TextMode theme.
Declaration
public static bool HasRequiredEntries(ColorPalette palette)
Parameters
| Type | Name | Description |
|---|---|---|
| ColorPalette | palette | The palette to check. May be null. |
Returns
| Type | Description |
|---|---|
| bool | True when the palette leads with the ANSI sixteen and defines every semantic entry. |
Remarks
The ANSI entries are checked by position as well as by name. A palette that defines all sixteen but orders them differently would render every piece of indexed text in the wrong color with no error anywhere, so it is rejected here instead.
Resolve(string)
Resolves a TextMode theme by name, preferring a registered palette and falling back to the classic theme and finally to the hard-coded palette.
Declaration
public static ColorPalette Resolve(string themeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | themeName | Name of the palette to resolve. When null or empty the classic theme is used. |
Returns
| Type | Description |
|---|---|
| ColorPalette | A palette that is guaranteed to satisfy HasRequiredEntries(ColorPalette). Never null. |
Remarks
A registered palette is only accepted when it leads with the sixteen ANSI entries in order and defines every name in SemanticEntryNames. Accepting a partial match would leave whichever colors it omits on whatever the previous theme happened to set, which reads as a rendering bug rather than a missing entry.