MarkdownStyleSheet.github constructor

MarkdownStyleSheet.github({
  1. Brightness brightness = Brightness.light,
})

Creates a GitHub-style theme that mimics GitHub's markdown rendering.

This theme closely matches the appearance of markdown on github.com, including:

  • GitHub's color palette (light: #24292F text, dark: #E6EDF3 text)
  • Rounded code block backgrounds
  • GitHub's link colors (light: #0969DA, dark: #58A6FF)
  • Familiar spacing and sizing

Parameters:

  • brightness: Whether to use light or dark variant (defaults to light)

Example:

// GitHub light theme
MarkdownStyleSheet.github()

// GitHub dark theme
MarkdownStyleSheet.github(brightness: Brightness.dark)

Perfect for documentation apps, README viewers, or any app that wants to match GitHub's familiar markdown aesthetic.

Implementation

factory MarkdownStyleSheet.github({Brightness brightness = Brightness.light}) {
  if (brightness == Brightness.dark) {
    return MarkdownStyleSheet.dark().copyWith(
      textStyle: const TextStyle(fontSize: 16, color: Color(0xFFE6EDF3)),
      codeBlockStyle: const TextStyle(
        fontFamily: 'monospace',
        fontSize: 14,
        color: Color(0xFFE6EDF3),
      ),
      codeBlockDecoration: BoxDecoration(
        color: const Color(0xFF161B22),
        borderRadius: BorderRadius.circular(6),
      ),
      linkStyle: const TextStyle(
        color: Color(0xFF58A6FF),
        decoration: TextDecoration.underline,
      ),
    );
  }

  return MarkdownStyleSheet.light().copyWith(
    textStyle: const TextStyle(fontSize: 16, color: Color(0xFF24292F)),
    codeBlockStyle: const TextStyle(
      fontFamily: 'monospace',
      fontSize: 14,
      color: Color(0xFF24292F),
    ),
    codeBlockDecoration: BoxDecoration(
      color: const Color(0xFFF6F8FA),
      borderRadius: BorderRadius.circular(6),
    ),
    linkStyle: const TextStyle(
      color: Color(0xFF0969DA),
      decoration: TextDecoration.underline,
    ),
  );
}