A Semantic Syntax Theme System
A color vocabulary for code.
You already know the difference between a class and a struct. Between an if statement and a method call. Between a constant and a variable. Lexicon makes your editor know it too. Every color carries meaning. Purple is always a reference type. Blue is always a value type. Orange is always a decision point. Once you learn the vocabulary, any C# codebase using Lexicon becomes easier to read—not because the code changed, but because you can see its structure at a glance.
This code sample demonstrates the Lexicon semantic syntax system. Use the theme selector to compare how each palette renders the same code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Lexicon.Demo;
// Interface: cyan + italic (behavioral contract)
public interface IDocumentProcessor
{
// Property: light blue (encapsulated access)
int ProcessedCount { get; }
// Callable: yellow (executable behavior)
Task<ProcessingResult> ProcessAsync(IEnumerable<Document> documents);
}
See the full sample in Complete Example and the palette in Lexicon Twilight below.
Lexicon addresses specific pain points that developers encounter when reading and reviewing code. Traditional syntax highlighting colors code by grammatical category: keywords in one color, strings in another, comments in gray. While this provides basic visual structure, it fails to surface semantic distinctions that matter for comprehension and debugging.
Semantic blindness. A traditional theme might color DateTime and Exception identically because both are type names. But DateTime is a value type (stack-allocated, copy semantics) while Exception is a reference type (heap-allocated, polymorphic). This distinction affects memory management, equality behavior, and API design—information worth surfacing visually, especially when debugging mutation or aliasing bugs.
Control flow invisibility. When tracing execution paths, developers need to identify decision points (if, switch) and iteration (for, while). Traditional themes color these the same as class and public—all "keywords." This forces cognitive search for the specific keywords that affect execution flow.
Exception boundary opacity. Exception handling constructs (try, catch, throw) define critical error boundaries. Traditional highlighting provides no visual distinction between these and other keywords, making it harder to quickly assess error handling coverage during code review.
Closure hazards hidden. Variables captured by lambdas or local functions have different lifetime and mutation semantics than ordinary locals. This is a common source of bugs (the classic loop-variable-capture issue), yet traditional highlighting provides no visual indication that a variable is captured.
Lexicon aims to:
Lexicon is currently implemented for C# development in Visual Studio 2026 using the Codist extension. The system depends on Codist's extended semantic classification capabilities, which go beyond Visual Studio's built-in Roslyn classifications. Without Codist, Lexicon's full semantic vocabulary cannot be rendered.
The scope is deliberately focused: one language, one IDE, one extension. The design aspiration is that the semantic vocabulary could eventually extend to other languages and editors, but this would require adaptation work. For now, Lexicon is where C# lives.
Lexicon is designed for developers who already understand C# syntax and semantics. It surfaces semantic distinctions rather than teaching language fundamentals. Three primary user populations and their tasks inform the design:
| User Population | Primary Tasks | Lexicon Value |
|---|---|---|
| Senior developers and architects | Code review, architecture assessment, API design review | Rapid pattern recognition: quickly identify type relationships, control flow complexity, and abstraction boundaries |
| Developers during debugging | Investigating bugs, tracing execution paths, understanding exception handling | Relevant information surfacing: captured variables, value vs reference semantics, exception boundaries visible at a glance |
| Developers onboarding to new codebases | Building mental models, understanding architectural patterns | Structural scaffolding: consistent semantic coloring helps identify patterns even before understanding specific logic |
Traditional syntax highlighting answers the question "What grammatical category is this token?" Lexicon answers a different question: "What role does this code element play in program execution?"
When you see a block of code styled with Lexicon, you don't parse tokens—you see patterns of meaning. Purple clusters indicate reference types. Cyan italic marks abstraction boundaries. Orange bold signals execution flow decisions.
| Approach | Classification Basis | Example Distinctions |
|---|---|---|
| Traditional (grammatical) | Token type from parser | keyword, identifier, string, number, comment |
| Visual Studio semantic | Roslyn semantic model | class name, struct name, interface name, method name, property name |
| Lexicon semantic | Developer mental model + Codist | reference type, value type, interface (italic), callable, data, data+bold (const/readonly), control flow (bold), exception, captured variable (background), obsolete (strikethrough) |
The key difference is not just what is distinguished, but why. Lexicon's categories are chosen to support specific developer tasks—debugging, code review, onboarding—not to mirror compiler internals.
All Lexicon themes share the same semantic mappings and decorations. What varies is the palette—the specific colors assigned to each category—and the emotional feel. Themes are different aesthetic schemes over the same vocabulary. Choose based on your environment, your vision, or simply what feels right.
| Theme | Saturation / Intensity | Accessibility Focus | Vibe |
|---|---|---|---|
| Twilight | Medium | Balanced contrast, general use | Evening sky, "magic hour" coding |
| Glacier | Low–medium | Gentler contrast, cooler palette | Arctic calm, reduced visual intensity |
| Ember | Medium–high | Warm bias, focused contrast | Late-night warmth and creative energy |
| Canopy | Medium | Green-centric, rich hue variety | Forest canopy, organic feel |
| Neon | High | Maximal category separation | Electric city, high-energy sessions |
| Solstice | Medium | Solarized-inspired balance | Calibrated, analytical, precise |
| Whisper | Low | Reduced visual demand | Soft, library-quiet coding |
| Nocturne | High | Strong contrast on true dark | Jewel tones on deep night |
| Patina | Low–medium | Warm, sepia-toned comfort | Aged copper, archival feel |
| Beacon | Very high | Accessibility-first, maximum separation | Signal over style, functional clarity |
The space between day and night, when colors are most alive.
Twilight is the flagship theme—the reference implementation that this document demonstrates. Named for that liminal hour when the sun has set but darkness hasn't arrived, when the sky holds impossible colors: deep blues, soft purples, warm golds against the fading light. There's a reason photographers call it the "magic hour."
The palette balances cool and warm. Purple types against yellow methods. Cyan structure against orange decisions. The dark background (#0d1117) provides depth without harshness—like looking at the sky just after sunset. This is a theme for long sessions: high enough contrast to read easily, soft enough to work in for hours. The trade-off is that some category pairs (purple/blue) require attention to distinguish; users who need maximum distinctness should consider Beacon or Neon.
The complete code sample in Complete Example uses this Twilight palette.
| Semantic | Color | Hex |
|---|---|---|
| Reference Types | Soft Purple | #bb9af7 |
| Value Types | Sky Blue | #7aa2f7 |
| Interfaces | Cyan | #7dcfff |
| Callables | Pale Yellow | #dcdcaa |
| Data | Light Blue | #9cdcfe |
| Control Flow | Orange | #ff9e64 |
| Exceptions | Coral | #f7768e |
| String Literals | Green | #9ece6a |
| Literal Values | Amber | #e0af68 |
| Namespaces | Teal | #4ec9b0 |
| Keywords | Violet | #9d7cd8 |
Cool, crystalline, calm. Ice fields under a pale sky.
Glacier draws from arctic landscapes: the blue-white of ancient ice, the pale violet of polar twilight, the surprising warmth of coral sunset reflected on snow. This is a reduced-saturation palette that maintains category differentiation while minimizing visual intensity.
For developers who find vivid colors fatiguing, or who work in bright environments where high contrast becomes harsh, Glacier offers relief. The colors are all shifted cooler—even the "warm" accents like orange control flow and coral exceptions carry blue undertones. The semantic vocabulary remains intact; everything just feels calmer, more contemplative. The trade-off: in very dark environments, the low saturation may reduce category distinctness. Like the landscape that inspired it, Glacier is focused and a bit severe.
| Semantic | Color | Hex |
|---|---|---|
| Reference Types | Pale Lavender | #b4a7d6 |
| Value Types | Ice Blue | #7eb8da |
| Interfaces | Glacier Cyan | #6dd3d6 |
| Callables | Pale Gold | #d4c896 |
| Data | Frost Blue | #a8d4e6 |
| Control Flow | Arctic Sunset | #e6a07c |
| Exceptions | Polar Rose | #e07c7c |
| String Literals | Lichen Green | #7ec8a3 |
| Literal Values | Sand | #d4b896 |
| Namespaces | Glacial Teal | #5eb8b0 |
| Keywords | Frost Violet | #a090c8 |
Warm coals in darkness. Comfort and intensity.
Ember inverts the usual temperature balance. Where most dark themes lean cool, Ember runs warm—the palette of dying coals, of candlelight, of autumn leaves against dark earth. This is a theme that feels alive, that radiates warmth from the screen.
Reference types become rose and coral. Data shifts to sand and copper. Even value types carry amber undertones. The sage green of string literals provides just enough cool contrast to keep the warmth from becoming oppressive. Ember is a theme for late nights and creative work, when the code is flowing and you want the environment to feel alive. The trade-off: the warm bias reduces blue-green distinctness, which may make some category pairs harder to separate at a glance.
| Semantic | Color | Hex |
|---|---|---|
| Reference Types | Rose | #e8a4b8 |
| Value Types | Copper | #d4a076 |
| Interfaces | Terra Cotta | #d08070 |
| Callables | Amber | #e6c87c |
| Data | Sand | #d4b896 |
| Control Flow | Flame | #e88050 |
| Exceptions | Ember Red | #d05050 |
| String Literals | Sage | #a0b890 |
| Literal Values | Honey | #c8a060 |
| Namespaces | Driftwood | #b09878 |
| Keywords | Dusty Rose | #c8a0a0 |
Dappled light through leaves. The forest floor at midday.
Canopy is built around green—the color we see more shades of than any other, the color of life and growth. Where other themes use green sparingly, Canopy lets it dominate. Data becomes moss. Value types become fern. String literals become spring leaves.
This isn't a gimmick. Green is the color human eyes are most sensitive to; we can distinguish more variations of green than any other hue. Canopy exploits this by using green for frequently-viewed categories. The result is a surprisingly readable palette that feels organic rather than synthetic. Purple reference types and orange control flow provide the contrast points, standing out against the verdant baseline like flowers in a meadow. The trade-off: users with red-green color vision deficiency may find this theme particularly challenging.
| Semantic | Color | Hex |
|---|---|---|
| Reference Types | Orchid | #c9a0dc |
| Value Types | Fern | #70a860 |
| Interfaces | Eucalyptus | #60b8a8 |
| Callables | Chartreuse | #b8c878 |
| Data | Moss | #8cb870 |
| Control Flow | Tiger Lily | #d89050 |
| Exceptions | Wild Rose | #d06070 |
| String Literals | Spring Green | #90d890 |
| Literal Values | Fern | #70a860 |
| Namespaces | Pine | #50a888 |
| Keywords | Wisteria | #a890b8 |
Electric signs on wet pavement. The city never sleeps.
Neon is unapologetically vivid. High saturation, maximum luminance, the palette of a cyberpunk future or a Tokyo side street at midnight. Where Twilight and Glacier exercise restraint, Neon turns everything up to eleven.
This isn't for everyone, but for developers who find muted themes dull, who want their editor to crackle with energy, Neon delivers. The colors are carefully balanced—the full spectrum is represented, so even at high saturation, purple reference types are clearly distinct from cyan value types, and orange control flow pops against electric green strings. The trade-off: high saturation may cause eye strain during extended sessions. Think of it as the difference between a jazz trio and a full orchestra. Both have their place.
| Semantic | Color | Hex |
|---|---|---|
| Reference Types | Electric Purple | #a855f7 |
| Value Types | Neon Cyan | #22d3ee |
| Interfaces | Teal Glow | #2dd4bf |
| Callables | Laser Yellow | #facc15 |
| Data | Plasma Blue | #38bdf8 |
| Control Flow | Signal Orange | #fb923c |
| Exceptions | Alarm Red | #f87171 |
| String Literals | Electric Lime | #a3e635 |
| Literal Values | Neon Cyan | #22d3ee |
| Namespaces | Radioactive Teal | #14b8a6 |
| Keywords | Ultraviolet | #c084fc |
Precision optics. Calibrated for the human eye.
Solstice adapts Ethan Schoonover's celebrated Solarized palette to Lexicon's semantic system. Solarized was engineered with scientific precision: CIELAB lightness values calculated to maintain consistent contrast across both light and dark modes, hues selected for maximum differentiation while remaining perceptually uniform.
Where Solarized treats all code uniformly, Solstice adds semantic meaning. Reference types get violet. Callables get yellow. Data gets the base gray. The careful calibration remains—every color still has the same perceptual lightness—but now the colors carry meaning. The trade-off: Solarized's uniform lightness can make some adjacent categories harder to distinguish without relying on hue. It's Solarized with a vocabulary.
| Semantic | Color | Hex |
|---|---|---|
| Reference Types | Violet | #6c71c4 |
| Value Types | Blue | #268bd2 |
| Interfaces | Cyan | #2aa198 |
| Callables | Yellow | #b58900 |
| Data | Base 0 | #839496 |
| Control Flow | Orange | #cb4b16 |
| Exceptions | Red | #dc322f |
| String Literals | Green | #859900 |
| Literal Values | Blue | #268bd2 |
| Namespaces | Cyan | #2aa198 |
| Keywords | Magenta | #d33682 |
Soft focus. Colors that don't shout.
Whisper is for developers who want syntax highlighting to guide, not dominate. Every color is desaturated, softened, pulled back toward gray. The result is a palette that still differentiates—purple is still visually distinct from yellow—but doesn't demand attention.
This theme works well for mixed work: writing prose interspersed with code, reviewing documentation, or any context where the code isn't the sole focus. It's also effective in very dark environments where even moderate saturation can feel harsh. Control flow becomes a gentle suggestion rather than a demand. Exceptions are noted, not alarmed about. The trade-off: the muted palette may reduce distinctness for users who benefit from high-contrast differentiation. Think of it as code in a library voice.
| Semantic | Color | Hex |
|---|---|---|
| Reference Types | Muted Lavender | #c9b8dc |
| Value Types | Soft Aqua | #a8d4d8 |
| Interfaces | Pale Teal | #a0d8d0 |
| Callables | Cream | #dcd8b0 |
| Data | Pale Blue | #b0d0dc |
| Control Flow | Soft Peach | #dcbca8 |
| Exceptions | Blush | #dcb0b0 |
| String Literals | Pale Mint | #b0dcb8 |
| Literal Values | Soft Aqua | #a8d4d8 |
| Namespaces | Sage | #98c8c0 |
| Keywords | Haze | #b8a8c8 |
Deep night. Jewel tones against void.
Nocturne adapts the beloved Dracula palette to Lexicon's semantic system. Pure dark with jewel-tone accents—perfect for OLED displays where true blacks save battery and maximize contrast, and for developers who work best in maximum dark adaptation.
The colors pop against the void like stars against the night sky. Purple reference types glow with amethyst intensity. Yellow callables catch the eye like distant lights. Orange control flow marks decision points with warm certainty. The semantic vocabulary is fully preserved; what changes is the drama. The trade-off: the high contrast and vivid colors may cause fatigue during very long sessions. This is code that feels like an occasion.
| Semantic | Color | Hex |
|---|---|---|
| Reference Types | Amethyst | #bd93f9 |
| Value Types | Ice | #8be9fd |
| Interfaces | Emerald | #50fa7b |
| Callables | Canary | #f1fa8c |
| Data | Aquamarine | #9aedfe |
| Control Flow | Topaz | #ffb86c |
| Exceptions | Ruby | #ff5555 |
| String Literals | Emerald | #50fa7b |
| Literal Values | Ice | #8be9fd |
| Namespaces | Emerald | #50fa7b |
| Keywords | Pink Sapphire | #ff79c6 |
Aged copper and old paper. Time-worn elegance.
Patina draws from the colors of age: oxidized bronze, yellowed paper, faded ink, weathered wood. It's a warm, desaturated palette with an antique quality—code that looks like it was written in a library from another century.
The sepia-shifted colors reduce blue light, making Patina easier on the eyes during long evening sessions. The low saturation keeps the warmth from becoming overwhelming. Reference types take on a dusty rose. Control flow becomes warm copper. String literals fade to sage. The trade-off: the muted, warm-shifted palette may reduce distinctness between some category pairs for users who need high contrast. It's sophisticated, understated, perhaps a bit melancholy. For developers who find modern vibrant themes too aggressive, Patina offers refuge.
| Semantic | Color | Hex |
|---|---|---|
| Reference Types | Dusty Rose | #b89898 |
| Value Types | Parchment | #c0b090 |
| Interfaces | Verdigris | #a0b098 |
| Callables | Old Gold | #d4c8a0 |
| Data | Linen | #c8c0a8 |
| Control Flow | Copper | #c89870 |
| Exceptions | Rust | #c07060 |
| String Literals | Faded Sage | #98a880 |
| Literal Values | Parchment | #c0b090 |
| Namespaces | Lichen | #90a090 |
| Keywords | Mauve | #a89898 |
Maximum signal. Designed for accessibility.
Beacon is designed for maximum visibility. Every color is at high saturation and near-maximum brightness. The palette may look garish in screenshots, but serves a specific purpose: accessibility for users with low vision or in challenging display conditions.
The colors are chosen to be maximally distinguishable across common forms of color vision deficiency. Red exceptions and green strings are both present but separated by significant lightness differences. Cyan and yellow provide primary differentiation for deuteranopia and protanopia. Strong lightness separation ensures elements stand out even when hue perception is impaired. The trade-off: Beacon will cause visual fatigue for users without vision impairments; it is designed as an accessibility accommodation, not a general-purpose theme.
See Accessibility Considerations for more detail on contrast and color vision assumptions behind this theme.
| Semantic | Color | Hex |
|---|---|---|
| Reference Types | Magenta | #ff00ff |
| Value Types | Dodger Blue | #1e90ff |
| Interfaces | Spring Green | #00ff7f |
| Callables | Yellow | #ffff00 |
| Data | Cyan | #00ffff |
| Control Flow | Orange | #ffa500 |
| Exceptions | Red | #ff4444 |
| String Literals | Chartreuse | #7fff00 |
| Literal Values | Dodger Blue | #1e90ff |
| Namespaces | Dark Turquoise | #00ced1 |
| Keywords | Orchid | #da70d6 |
This section reviews research that informed Lexicon's design. These studies provide theoretical grounding and design principles for the semantic approach. See Section 12 for validation status.
In 1988, Ronald Baecker demonstrated that visual enhancements could improve program comprehension. His study found that improved layout—combining typography, indentation, and color—increased correct answers by 11% and improved readability by 25%.[1] These improvements came from combined visual enhancements, providing evidence that thoughtful visual design aids code reading.
A 2015 eye-tracking study by Advait Sarkar found that developers reading highlighted code exhibited lower cognitive load indicators than those reading plain text.[2] The benefit became weaker with increased programming experience, suggesting that highlighting may provide greatest benefit during onboarding to unfamiliar codebases—one of Lexicon's explicit design goals.
The most important finding for semantic highlighting comes from Gilmore and Green's work on "programming plans."[3] Their study found that visual cues only helped when they matched the task at hand. Participants found surface bugs faster with control-structure highlighting, but deep bugs faster with cognitive-plan coloring. This insight drives Lexicon's category selection: categories are chosen to align with tasks developers actually perform.
Elliot and Maier's Color-in-Context Theory[4] establishes that color carries psychological meaning and influences cognitive processing, often without conscious awareness. Lexicon uses this as a design heuristic: warm colors (orange) for attention-demanding constructs like control flow, cool colors (blue, purple) for structural elements, desaturated red (coral) for exceptions to distinguish from IDE error markers.
Color has meaning, and this has a direct and automatic influence on cognitive processes, including attention.
— Elliot & Maier, Color-in-Context Theory
George Miller's (1956) "seven plus or minus two" finding[5] concerns serial recall of arbitrary items in short-term memory—not visual categorization. Research on visual search suggests that practiced users can distinguish many more than seven categories when the categories are meaningful and consistent. Lexicon's eleven semantic categories cluster into related groups (types, data, flow) that map to distinctions developers already make. With use, the vocabulary becomes intuitive.
The semantic map defines eleven categories of code elements, each assigned a consistent color role across all theme variations. This mapping reflects how developers conceptualize code architecture during debugging and review tasks.
| Category | Semantic Role | C# Examples | Color Family |
|---|---|---|---|
| Reference Types | Heap-allocated, polymorphic types | Classes, records, delegates, string |
Purple |
| Value Types | Stack-allocated, copy-semantic types | Structs, enums, int, DateTime |
Blue |
| Interfaces | Behavioral contracts, abstraction boundaries | IDisposable, IEnumerable<T> |
Cyan + Italic |
| Callables | Executable behavior | Methods, constructors, local functions | Yellow |
| Data | Named storage locations | Fields, properties, parameters, locals; const and readonly use bold | Light Blue (bold for immutable) |
| Control Flow | Execution path decisions and iteration | if, else, switch, for, foreach, while |
Orange + Bold |
| Exceptions | Error handling boundaries | try, catch, throw, finally, when* |
Coral |
| String Literals | Text data, often user-facing content | "text", $"interpolated", @"verbatim" |
Green |
| Literal Values | Primitive literal values and enum members | 42, 3.14, true, false, null, enum members |
Amber (bold for enum members) |
| Namespaces | Organizational scope | Namespace identifiers | Teal |
| Keywords | Language reserved words (non-control-flow) | class, public, async, var |
Soft Purple |
* The when keyword is only styled as an exception keyword when it appears in a catch clause filter (e.g., catch (Exception ex) when (...)). In pattern matching contexts such as switch expressions, when is styled as a regular keyword since it serves control flow rather than exception handling.
Following Gilmore and Green's finding that visual cues help only when matched to task, each category was selected based on specific developer tasks where the distinction provides value.
The distinction between reference types (purple) and value types (blue) is fundamental to C# programming and directly affects debugging. When a List<Order> is passed to a method, modifications affect the original—the caller and callee share the same object. When a DateTime is passed, the method receives a copy. Mutation bugs, aliasing issues, and null reference exceptions all trace back to this distinction. Making it visible accelerates root cause analysis.
Task alignment: Debugging mutation/aliasing bugs, understanding equality semantics, API design review.
Interfaces (cyan italic) mark abstraction boundaries—behavioral contracts that define how components interact. The italic styling reinforces that interfaces represent indirection: what you see in the code (the interface type) might not be what runs (the concrete implementation). During code review, cyan italic clusters indicate areas where behavior varies at runtime.
Task alignment: Architecture review, dependency analysis, understanding testability and mock boundaries.
Callables (yellow) represent executable behavior—methods, constructors, local functions. Yellow is used because callables are action points: locations where execution transfers, where side effects occur, where work happens. In a sea of data and types, yellow marks the verbs.
Task alignment: Understanding execution flow, identifying side effects, performance analysis.
Data (light blue) encompasses all named storage: fields, properties, parameters, and locals. These are unified because from a reading perspective, they all represent "a place where a value lives." The naming convention (_field vs local) already distinguishes scope; color distinguishes the semantic category "storage" from "type" and "action."
Const fields and readonly fields share the Data color but use bold styling to signal immutability. This keeps them visually connected to other data (they're still storage locations) while clearly marking that their values cannot change. During debugging, bold data members are safe harbors—they're not the source of unexpected state changes.
Task alignment: Understanding data flow, tracking state changes, identifying unused variables, magic number auditing.
Control flow (orange, bold) unifies all execution-path keywords: conditionals (if, switch), loops (for, while, foreach), and jumps (break, continue, return). Traditional highlighting scatters these among generic "keywords." Lexicon makes decision points visible at a glance.
Task alignment: Tracing execution paths, understanding branching complexity, debugging state-dependent behavior.
Exception handling (coral) marks error boundaries: try, catch, throw, finally, and the when filter in catch clauses. Note that when in pattern matching contexts (switch expressions) remains a regular keyword, as it serves control flow rather than exception handling. Coral is used rather than bright red to distinguish from IDE error squiggles—exception handling is intentional error management, not an error. During code review, coral blocks show where errors are expected and handled.
Task alignment: Reviewing error handling coverage, understanding failure modes, ensuring cleanup code runs.
String literals (green) and literal values (amber) are separated because they require different developer attention. Strings often need localization review, format verification, or resource management consideration. Literal values—numbers, boolean literals, null, and enum members—often need magic-constant auditing or constant extraction. Keeping them visually distinct supports targeted review tasks.
The Literal Values category includes true, false, null, and enum members because these share the semantic character of numeric literals: they are raw, literal values written directly in code rather than computed or referenced from storage. Enum members like ProcessingStatus.Success are conceptually the same as writing a numeric constant—they're named literal values. The bold styling on enum members signals their fixed nature while the amber color groups them with other literals.
Task alignment: Localization review (strings), magic-constant audit (literal values), identifying hardcoded values.
Namespaces (teal) provide organizational context. Keywords (soft purple) cover language reserved words that don't fit other categories—structural keywords like class, public, and async. These form the grammatical backbone of the code without demanding special attention.
For a compact reminder of these eleven categories, see Quick Reference below.
Visual hierarchy research is clear: every element competes for attention. When everything is bold, nothing is bold. Codist offers dozens of styling options, but Lexicon uses only six, each passing a simple test: does this tell me something color alone cannot?
[Obsolete]. Don't use this.
When multiple decorations could apply to a single token, Lexicon follows a defined precedence hierarchy:
| Priority | Decoration | Semantic | Rationale |
|---|---|---|---|
| 1 (Highest) | Strikethrough + Dimmed | Obsolete/Deprecated | Deprecation is a critical warning that overrides all other styling |
| 2 | Background Tint | Captured Variable | Closure capture is a common bug source; must remain visible |
| 3 | Bold | Constant/Static | Immutability is important but not an error condition |
| 4 | Italic | Interface/Virtual/Extension | Indirection matters but is less urgent than capture/deprecation |
| 5 | Dimmed | Unused | Low priority; unused obsolete code shows strikethrough, not dimming |
| 6 (Lowest) | Smaller | Attributes | Metadata styling has lowest priority |
Combination rules: Background tint combines with bold and italic (a captured constant shows both bold and background tint). Strikethrough overrides dimming. When a token is both obsolete and captured, strikethrough takes precedence but the background tint is preserved if technically possible.
Bold = Immutability, not emphasis. In typical text, bold means "important." In Lexicon, bold means "fixed at compile time." This is a learned convention.
Italic = Indirection, not emphasis. Italic marks elements where the actual behavior may differ from what the source code shows (interfaces, virtual methods, extension methods).
Coral ≠ Error. Exception handling uses coral (desaturated red) deliberately to distinguish from IDE error markers (bright red). This avoids alarm fatigue in codebases with extensive exception handling.
Lexicon is implemented for Visual Studio 2026 with the Codist extension. This section explains requirements and capabilities.
Visual Studio provides semantic tokens through its Roslyn-based classification system, but Lexicon requires capabilities that Codist adds:
if, for, while from other keywords.Even with Codist, some desired classifications are not available:
| Desired Classification | Status | Workaround |
|---|---|---|
| Async methods | Not available | Naming convention (*Async) |
| Pure vs. impure methods | Not available | None |
| Nullable reference types | Partial | IDE warnings |
1. Install the Codist extension from the Visual Studio Marketplace.
2. Open Codist settings (Tools → Codist → Options).
3. Import the desired Lexicon theme file (JSON).
To experience Lexicon effectively on first use, follow this simple path:
A handy reminder for the eleven semantic categories:
This code sample demonstrates the Lexicon semantic syntax system with all major semantic categories and decorations:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Lexicon.Demo;
// Interface: cyan + italic (behavioral contract)
public interface IDocumentProcessor
{
// Property: light blue (encapsulated access)
int ProcessedCount { get; }
// Callable: yellow (executable behavior)
Task<ProcessingResult> ProcessAsync(IEnumerable<Document> documents);
}
// Reference type: purple (heap-allocated, polymorphic)
[ServiceLifetime(ServiceLifetime.Scoped)]
public class DocumentProcessor : IDocumentProcessor, IDisposable
{
// # Constants (data + bold)
private const int MaxRetries = 3;
private const string DefaultName = "Untitled";
// # Fields
private readonly ILogger _logger;
private bool _isDisposed;
// Property: light blue
public int ProcessedCount { get; private set; }
public DocumentProcessor(ILogger logger)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
}
public async Task<ProcessingResult> ProcessAsync(IEnumerable<Document> documents)
{
var results = new List<DocumentResult>();
var retryCount = 0;
// Control flow: orange + bold (execution path decisions)
foreach (var document in documents)
{
try
{
// Captured variable: background tint (closure warning)
var result = await RetryAsync(async () =>
{
retryCount++; // CAPTURED by lambda
return await ProcessSingleAsync(document);
}, MaxRetries);
results.Add(result);
ProcessedCount++;
}
catch (ProcessingException ex) when (ex.IsRetryable)
{
_logger.LogWarning($"Retryable: {ex.Message}");
}
catch (Exception ex)
{
_logger.LogError(ex, "Processing failed");
throw;
}
}
// Switch expression with pattern matching
var status = results.Count switch
{
0 => ProcessingStatus.NoDocuments,
_ when results.All(r => r.Success) => ProcessingStatus.AllSucceeded,
_ => ProcessingStatus.PartialSuccess
};
return new ProcessingResult(results, status);
}
// Obsolete method: strikethrough decoration
[Obsolete("Use ProcessAsync instead")]
public void Process(Document doc) => throw new NotSupportedException();
}
// Value type (struct): blue
public readonly struct ProcessingResult
{
public IReadOnlyList<DocumentResult> Results { get; }
public ProcessingStatus Status { get; }
}
// Enum: blue (value type), members are literal values (amber + bold)
public enum ProcessingStatus
{
NoDocuments,
AllSucceeded,
PartialSuccess,
AllFailed
}
Lexicon addresses accessibility through a dedicated high-contrast theme (Beacon), careful contrast consideration in the flagship theme (Twilight), and documented limitations. This section presents calculated accessibility data and acknowledges testing gaps.
The Web Content Accessibility Guidelines (WCAG) 2.1 specify minimum contrast ratios: Level AA requires 4.5:1 for normal text; Level AAA requires 7:1.[6] The following table presents calculated contrast ratios for Lexicon Twilight against background #0d1117. These are computed values using the WCAG relative luminance formula; actual display contrast varies with monitor calibration, ambient lighting, and individual vision.
| Category | Hex | Contrast Ratio | WCAG Level |
|---|---|---|---|
| Reference Types | #bb9af7 | 8.1:1 | AAA ✓ |
| Value Types | #7aa2f7 | 6.8:1 | AA ✓ |
| Interfaces | #7dcfff | 9.3:1 | AAA ✓ |
| Callables | #dcdcaa | 11.3:1 | AAA ✓ |
| Data | #9cdcfe | 10.1:1 | AAA ✓ |
| Control Flow | #ff9e64 | 7.6:1 | AAA ✓ |
| Exceptions | #f7768e | 7.0:1 | AAA ✓ |
| String Literals | #9ece6a | 8.2:1 | AAA ✓ |
| Literal Values | #e0af68 | 9.5:1 | AAA ✓ |
| Namespaces | #4ec9b0 | 8.4:1 | AAA ✓ |
| Keywords | #9d7cd8 | 6.0:1 | AA ✓ |
All Twilight colors meet WCAG 2.1 Level AA requirements (4.5:1 minimum). Nine of eleven categories meet Level AAA (7:1). The two categories meeting only AA (Value Types at 6.8:1 and Keywords at 6.0:1) remain well above the minimum threshold.
Approximately 8% of males and 0.5% of females have some form of color vision deficiency (CVD). Lexicon's palette presents potential challenges:
Deuteranopia/Protanopia (red-green, most common): Orange (control flow) and green (string literals) may be difficult to distinguish. The design partially mitigates this by using bold weight on control flow, providing a non-color differentiation cue. However, simulation testing has not been performed.
Tritanopia (blue-yellow): Purple (reference types) and blue (value types) may be difficult to distinguish. This affects a core semantic distinction. Users with tritanopia should consider the Beacon theme, which maximizes lightness separation between all hues.
Some developers, including those with dyslexia or certain visual processing differences, may find italic text harder to read. Interfaces and virtual methods use italic styling; this is a trade-off between semantic meaning and readability.
Users who find italics hard to read can adjust Lexicon themes by using a variant with italics removed or by overriding font style for interfaces and virtual methods in Codist's classification settings.
The Neon and Beacon themes use high-saturation colors that may cause visual fatigue for some users. The Whisper, Glacier, and Patina themes offer lower-saturation alternatives.
Lexicon's design is informed by research on program comprehension, syntax highlighting, and color psychology—but Lexicon itself has not been empirically validated. This section consolidates the key limitations and validation gaps.
Research-informed, not empirically validated. The studies cited in this document provide theoretical grounding and design principles; they do not validate that Lexicon's specific implementation produces the intended benefits.
Design hypotheses, not measured outcomes. Any benefits for comprehension speed, error detection rate, or cognitive load reduction are design hypotheses based on the research literature. Formal user studies would be needed to measure whether Lexicon actually delivers these benefits in practice.
Calculated accessibility values. The WCAG contrast ratios presented in Section 11 are calculated using standard formulas, not measured on actual hardware under controlled display conditions. Real-world contrast depends on monitor calibration, ambient lighting, and display technology.
No formal user studies. No controlled experiments have been conducted on Lexicon specifically. The design is informed by prior research on syntax highlighting and program comprehension, but has not been independently validated.
Single language: Lexicon currently supports only C#. The semantic vocabulary is designed with C#'s type system in mind.
Extension dependency: Codist is required for full functionality. Some semantic distinctions (captured variables, control flow separation) cannot be rendered without it.
Color reliance: Lexicon relies heavily on color to convey meaning. Developers with certain forms of color vision deficiency may find some distinctions difficult to perceive, even with the Beacon theme.
Controlled comparison of task performance between Lexicon and traditional highlighting would help validate (or refute) the design hypotheses. Useful metrics would include comprehension speed, bug detection rate, and subjective cognitive load ratings.
Laboratory measurement of contrast ratios on calibrated displays, CVD simulation testing, and usability testing with accessibility-needs populations would strengthen the accessibility claims.
Expanding to other editors (particularly VS Code) and other languages with similar type systems would allow the semantic vocabulary to benefit a wider range of developers.