Skip to main content

Themes

Every colour, shadow, pin shape, size, spacing, thickness, radius, font, duration and easing of the editor is a theme token. A theme is data: a set of token values laid over the editor's own, never code and never XAML.

Modes and presets​

The mode (netprints.editor.theme) is dark, light or system. The mode picks the variant: system follows the operating system.

Each variant has its own preset, chosen on Settings › Appearance or with darkPreset and lightPreset in settings.json. A preset is applied at once, with no restart, and a preset of the Dark variant never changes a token of the Light variant.

PresetVariantId
NetPrints DarkDarknetprints.dark
NetPrints LightLightnetprints.light
High contrastDarkhigh-contrast.dark
High contrastLighthigh-contrast.light
  • NetPrints Dark and NetPrints Light are the defaults: diamond type pins, a #262626 canvas and a #D9141414 card in Dark.
  • High contrast runs on Semi's own high-contrast variant of its slot (Aquatic for Dark, Desert for Light) with NetPrints tokens tuned for it: a solid border on every node, yellow or dark-blue focus and selection, stronger grid lines and an opaque, thicker wire. In system mode the tuned tokens apply, and Semi's variant is not selected.

An id that names no preset of its variant falls back to the variant's default, with an entry in the log. The other appearance keys still apply.

The Preview strip under the two choices shows the canvas, the node card, four pin colours and the selected wire of each chosen preset.

Contrast policy​

The built-in presets pass every gate below, and a test fails the build when one does not. A theme of your own, when user themes arrive, applies even if it fails them; the editor warns and names the pairs.

GatePairMinimum
Headereach node role colour against the header text4.5:1
Titlethe node title against the node body4.5:1
Pineach pin colour against the node body and the canvas3:1
Wireeach wire, drawn at its opacity, against the canvas and the node body3:1
Cardthe node body against the canvas1.15:1

The ratio is compared as measured, with no rounding.

The theme file​

A preset is a *.nptheme.json file with schemaVersion 1, an id, a label, a base (dark or light), an optional semiVariant and a tokens map from a token name to a value written as text.

{
"schemaVersion": 1,
"id": "my.dark",
"label": "My Dark",
"base": "dark",
"tokens": {
"Canvas.Background": "#FF101010",
"Node.CardBackground": "#E0181818",
"Wire.Thickness": "5"
}
}

An unknown token is warned about and ignored. A bad value is warned about and keeps the base value. A newer schema, a file that is not JSON and a file over 262144 characters are skipped. A token you leave out keeps its base value.

Values by kind: a colour or brush is #RRGGBB or #AARRGGBB; a number is a plain decimal; a shadow is a list such as 4 4 8 0 #80000000; the pin shape is triangle or diamond. A thickness is 4, 8,2 or 1,0,1,0; a corner radius is 4 or 4,4,0,0; a grid length is 120, Auto or 2*; a font family is a family name such as Cascadia Mono (no URL or font file); a duration is h:m:s such as 0:0:0.15; an easing is the four numbers x1,y1,x2,y2 of a cubic Bézier curve, with x from 0 to 1.

Semi's own resources (accents, fonts and density) are not NetPrints tokens and are not listed here; see the Semi.Avalonia repository for their keys.

The token list​

The list is generated from the token catalogue. Update it with NETPRINTS_UPDATE_SNAPSHOTS=1 and ThemesGuideTests.

TokenKindOne value per variant
Canvas.BackgroundColoryes
Tab.StripBorderColoryes
GraphGrid.MinorColorColoryes
GraphGrid.MajorColorColoryes
StartPage.RecentTileBackgroundBrushyes
Focus.RingBrushyes
State.HoverBrushyes
State.PressedBrushyes
Row.SeparatorBrushyes
Tab.SelectedAccentBrushyes
GraphWatermark.ForegroundBrushyes
Node.CardBackgroundBrushyes
Node.TitleForegroundBrushyes
Node.SubtitleForegroundBrushyes
OpeningGraphIndicator.BackgroundBrushyes
OpeningGraphIndicator.ForegroundBrushyes
BusyOverlay.BackgroundBrushyes
Popup.BackgroundBrushyes
Pin.HoverStrokeBrushyes
Diagnostic.Error.ForegroundBrushyes
Diagnostic.Warning.ForegroundBrushyes
Diagnostic.Info.ForegroundBrushyes
CommandBar.BadgeBackgroundBrushyes
CommandBar.BadgeForegroundBrushyes
Icon.Method.ForegroundBrushyes
Icon.Property.ForegroundBrushyes
Icon.Event.ForegroundBrushyes
Icon.Class.ForegroundBrushyes
Node.HeaderForegroundBrushyes
Node.BorderBrushyes
Pin.DefaultValueBrushyes
Pin.HintBrushyes
Canvas.SelectionBorderBrushyes
Canvas.MarqueeFillBrushyes
Canvas.MarqueeBorderBrushyes
Canvas.WireSelectedBrushyes
Inspector.CategoryHeaderBackgroundBrushyes
Inspector.CategoryHeaderForegroundBrushyes
Inspector.ModifiedMarkerBrushyes
Inspector.EditorBackgroundBrushyes
Inspector.EditorBorderBrushyes
Node.Header.EntryBrushyes
Node.Header.CallBrushyes
Node.Header.PureBrushyes
Node.Header.FlowBrushyes
Node.Header.VariableBrushyes
Node.Header.ConstructorBrushyes
Node.Header.AsyncBrushyes
Node.Header.ThrowBrushyes
Pin.ExecBrushyes
Pin.TypeBrushyes
Pin.BoolBrushyes
Pin.IntegerBrushyes
Pin.FloatBrushyes
Pin.StringBrushyes
Pin.ObjectBrushyes
Pin.ValueTypeBrushyes
Pin.DelegateBrushyes
Pin.GenericBrushyes
Node.CardShadowShadowyes
Popup.ShadowShadowyes
Wire.OpacityNumberyes
Wire.ThicknessNumberyes
Inspector.RowSpacingNumberyes
Pin.TypeShapeShapeno
Pin.OutlineThicknessNumberno
StartPage.RecentTileSizeNumberno
StartPage.LogoSizeNumberno
Font.CaptionNumberno
Font.BodyNumberno
Font.SubtitleNumberno
Font.TitleNumberno
Font.WatermarkNumberno
Space.XS.SizeNumberno
Space.S.SizeNumberno
Space.M.SizeNumberno
Space.L.SizeNumberno
Space.XL.SizeNumberno
Icon.SmallNumberno
Icon.MediumNumberno
Icon.LargeNumberno
Tab.HeightNumberno
Tab.CloseButtonSizeNumberno
Tab.InactiveOpacityNumberno
Density.RowHeightNumberno
Density.CommandBarHeightNumberno
VariableChip.SizeNumberno
Dialog.MinWidthNumberno
Dialog.MaxWidthNumberno
Dialog.ListMaxHeightNumberno
Flyout.MethodPickerWidthNumberno
Space.XSThicknessno
Space.SThicknessno
Space.MThicknessno
Space.LThicknessno
Space.XLThicknessno
Focus.RingThicknessThicknessno
Tab.SelectedBorderThicknessThicknessno
Tab.StripOverlapThicknessno
Tab.InactiveInsetThicknessno
Tab.BodyPaddingThicknessno
Tab.SelectedBodyPaddingThicknessno
Tab.AccentThicknessThicknessno
Density.RowPaddingThicknessno
Row.PaddingThicknessno
Row.ChipMarginThicknessno
Row.TypeMarginThicknessno
SectionHeader.MarginThicknessno
SectionHeader.SpacedMarginThicknessno
Radius.ControlCornerRadiusno
Radius.TabCornerRadiusno
Inspector.LabelColumnWidthGridLengthno
Row.RemoveColumnWidthGridLengthno
Font.MonoFontFamilyno
Motion.FastDurationno
Motion.NormalDurationno
Motion.EasingEasingno