ByteColorScheme.fromTheme constructor

ByteColorScheme.fromTheme(
  1. ThemeData theme
)

Creates a color scheme that automatically adapts to the app's theme.

Returns ByteColorScheme.dark for dark themes and ByteColorScheme.standard for light themes based on ThemeData.brightness.

Example:

HexViewer(
  data: myData,
  config: HexConfig(
    colorScheme: ByteColorScheme.fromTheme(Theme.of(context)),
  ),
)

Implementation

factory ByteColorScheme.fromTheme(ThemeData theme) {
  final isDark = theme.brightness == Brightness.dark;
  return isDark
      ? const ByteColorScheme.dark()
      : const ByteColorScheme.standard();
}