Color class abstract Style
Abstract base class for terminal colors.
All color types implement this interface to produce ANSI escape sequences.
Colors in Artisanal are profile-aware. The ColorProfile determines how colors are rendered (ANSI 16, ANSI 256, or TrueColor).
- BasicColor: Standard 16 ANSI colors.
- AnsiColor: 256-color palette.
- CompleteColor: Full 24-bit RGB colors.
- AdaptiveColor: Automatically chooses between light/dark variants.
Constructors
- Color()
-
const
- Color.adaptive({required Color light, required Color dark})
-
Creates an adaptive color that switches based on terminal background.
factory
- Color.ansi(int code)
-
Creates an ANSI color from a code (0-255).
factory
- Color.basic(String value)
-
Creates a basic color from a hex string or ANSI code string.
factory
- Color.complete({required String trueColor, String? ansi256, String? ansi})
-
Creates a complete color with explicit values for each color profile.
factory
- Color.completeAdaptive({required CompleteColor light, required CompleteColor dark})
-
Creates a complete adaptive color with light and dark variants.
factory
- Color.defaultColor()
-
Creates a default color using the terminal's default color.
factory
- Color.noColor()
-
Creates a color with no color styling.
factory
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toAnsi(
ColorProfile profile, {bool background = false, bool underline = false, bool hasDarkBackground = true}) → String - Produces the ANSI escape sequence for this color.
-
toHex(
) → String - Returns the hex representation of this color.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited