PSChristmasTree Configuration Guide
Overview
PSChristmasTree now uses a structured configuration model (v3) with explicit domains:
LanguageTreeDecorationsColorsDisplayAudioMessages
The configuration system is designed for both interactive and scripted usage:
- Interactive users can run a full setup wizard.
- Scripted users can patch specific sections with parameters.
- Runtime parameters in
Show-PSChristmasTreestill override saved values.
Quick Start
Interactive Setup Wizard
Set-PSChristmasTreeConfig
Wizard flow:
- Language
- Built-in tree style
- Optional custom ASCII tree import
- Ornament-pattern illumination (default or custom)
- Color behavior (multicolor, single, palette, sensible defaults)
- Animation and display behavior
- Sound and message toggles
- Optional custom messages
Built-in style note:
Classic, Minimal, and Wide all include ornament symbol patterns in their ASCII text so decoration mapping has visible targets.
Run with Saved Config
Show-PSChristmasTree
Inspect Saved Config
Get-PSChristmasTreeConfig
Reset Saved Config
Reset-PSChristmasTreeConfig -Confirm:$false
Config Schema (v3)
Example persisted JSON:
{
"ConfigVersion": 3,
"Language": {
"UICulture": "fr-FR"
},
"Tree": {
"Style": "Classic",
"CustomPath": ""
},
"Decorations": {
"Mode": "Default",
"IncludeDefaults": true,
"Defaults": {
"O": "random"
},
"Map": {}
},
"Colors": {
"Mode": "Multicolor",
"SingleColor": "Green",
"Palette": ["Green", "Red", "Yellow"]
},
"Display": {
"AnimationLoopNumber": 50,
"AnimationSpeed": 300,
"HideCursor": true
},
"Audio": {
"PlayCarol": 0
},
"Messages": {
"Show": true,
"Custom": {}
}
}
Decorations sub-fields
| Field | Type | Description |
|---|---|---|
Mode |
Default | Custom |
Default uses the built-in Defaults map only (and always clears Map). Custom uses Map, optionally merged with Defaults when IncludeDefaults is true. |
Defaults |
hashtable | Built-in symbol-to-color map applied in both modes. Default: { 'O': 'random' }. The trunk is automatically colored Red at render time regardless of its exact pattern — no need to declare it here. |
Map |
hashtable | User-defined symbol-to-color map. Only active when Mode is Custom. Always empty when Mode is Default. |
IncludeDefaults |
boolean | When true and Mode is Custom, Defaults is merged into Map. |
Note: Decorations do not add new symbols to the tree. They map colors to ornament patterns already present in the ASCII art.
Trunk color: The trunk is automatically colored
Redby default for all built-in styles and custom trees alike. Override it at runtime with-TrunkColor, or add the exact trunk pattern to your customMapto override it persistently.
Color mode palette behavior
The effective Palette used for rendering is derived from Mode:
Mode |
Effective palette |
|---|---|
Multicolor |
All 16 .NET ConsoleColor values |
Single |
[ SingleColor ] only |
Palette |
Provided values; falls back to all 16 colors if the list is empty |
CustomMessages valid keys
The Custom object inside Messages accepts only these four keys:
| Key | Description |
|---|---|
MerryChristmas |
Main greeting displayed under the tree |
HappyNewYear |
Secondary message |
MessageForDevelopers |
Developer-targeted message |
CodeWord |
Short code word / tagline |
Any other keys are silently ignored during normalization.
Example:
Set-PSChristmasTreeConfig -CustomMessages @{
MerryChristmas = 'Happy Holidays!'
HappyNewYear = 'See you in the new year!'
}
Command Usage
Scripted Updates
Set-PSChristmasTreeConfig -UICulture fr-FR -TreeStyle Wide -AnimationSpeed 120
Set-PSChristmasTreeConfig -ColorMode Single -SingleColor Green
Set-PSChristmasTreeConfig -ColorMode Palette -Palette @('Green','Yellow','Red')
Set-PSChristmasTreeConfig -DecorationMode Custom -Decorations @{ '*' = 'Yellow'; 'i' = 'random' }
Set-PSChristmasTreeConfig -Config @{
Display = @{ AnimationLoopNumber = 30; AnimationSpeed = 200 }
Audio = @{ PlayCarol = 1 }
}
Runtime Overrides
Show-PSChristmasTree -AnimationSpeed 80 -ColorMode Single -SingleColor Cyan
Precedence Rules
Resolution order:
- Explicit runtime parameters (
Show-PSChristmasTree ...) - Saved user config (
Set-PSChristmasTreeConfig) - Built-in defaults (
Get-PSChristmasTreeDefaultConfig)
Validation and Recovery
Validation is strict and centralized:
- Invalid colors are silently filtered. Any color name that is not a valid
[System.ConsoleColor]value (or the special keywordrandom) is removed fromPalette,Map, andDefaultswithout a warning. The rest of the list is kept. - Invalid ranges fall back to defaults.
AnimationLoopNumberandAnimationSpeedmust be ≥ 1;PlayCarolmust be ≥ 0. - Invalid booleans are normalized. String values such as
"true"/"false"are parsed; anything unrecognised falls back to the default. - Legacy flat schema is auto-migrated. A config file saved before v3 is detected and remapped in memory — no manual migration required.
DecorationMode: Defaultalways clearsMap. Even if you write values intoMap, they are discarded at normalize time whenModeisDefault.
If JSON is corrupted or unreadable, config load gracefully warns and runtime falls back to defaults.
File Location
- Windows:
%APPDATA%\PSChristmasTree\config.json - Linux/macOS:
$HOME/.config/PSChristmasTree/config.json