ByteColorScheme class

Color scheme for syntax highlighting different byte types in the hex viewer.

This class defines colors for various byte categories to provide visual cues about data content:

  • Null bytes (0x00) - typically shown in gray
  • Printable ASCII (0x20-0x7E) - regular text characters
  • Control characters (0x01-0x1F) - shown in red to highlight special bytes
  • Extended ASCII (0x80+) - shown in blue for non-standard characters

Example:

// Use predefined schemes:
const lightScheme = ByteColorScheme.standard();
const darkScheme = ByteColorScheme.dark();

// Auto-adapt to app theme:
final scheme = ByteColorScheme.fromTheme(Theme.of(context));

// Custom colors:
const custom = ByteColorScheme(
  nullByte: Colors.grey,
  printableAscii: Colors.black,
  controlChar: Colors.red,
  extendedAscii: Colors.blue,
  selectedBackground: Colors.blue,
  selectedForeground: Colors.white,
);

See also:

Constructors

ByteColorScheme({required Color nullByte, required Color printableAscii, required Color controlChar, required Color extendedAscii, required Color selectedBackground, required Color selectedForeground})
Creates a custom color scheme with explicit colors for each byte type.
const
ByteColorScheme.dark()
Dark theme color scheme optimized for dark mode.
const
ByteColorScheme.fromTheme(ThemeData theme)
Creates a color scheme that automatically adapts to the app's theme.
factory
ByteColorScheme.standard()
Standard color scheme optimized for light mode.
const

Properties

controlChar → Color
Color for control characters (0x01-0x1F).
final
extendedAscii → Color
Color for extended ASCII and high bytes (0x80+).
final
hashCode → int
The hash code for this object.
no setterinherited
nullByte → Color
Color for null bytes (0x00).
final
printableAscii → Color
Color for printable ASCII characters (0x20-0x7E).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectedBackground → Color
Background color for selected bytes.
final
selectedForeground → Color
Text color for selected bytes.
final

Methods

getColorForByte(int byte) → Color
Returns the appropriate color for a specific byte value.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited