Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blinding white code blocks in dark mode #82

Closed
ego-lay-atman-bay opened this issue Jun 3, 2024 · 5 comments · Fixed by #85 or #101
Closed

Blinding white code blocks in dark mode #82

ego-lay-atman-bay opened this issue Jun 3, 2024 · 5 comments · Fixed by #85 or #101
Assignees
Labels
enhancement New feature or request

Comments

@ego-lay-atman-bay
Copy link

I just tried this notes app out, and it's nice, but has some issues. I use dark mode all the time, but when I use a code block in this app, the background is blinding white.
Screenshot_20240602-201734

I tried to search for an existing issue for this, but it doesn't look like anyone else has reported this issue (and I'm surprised it even is, because the screenshots use dark mode).

My device: Google Pixel 6a
OS: Android 14
App version: 1.3.0

@maelchiotti maelchiotti self-assigned this Jun 3, 2024
@maelchiotti maelchiotti added the enhancement New feature or request label Jun 3, 2024
@maelchiotti maelchiotti moved this to Next release in LocalMaterialNotes Jun 3, 2024
@maelchiotti maelchiotti moved this from Next release to In progress in LocalMaterialNotes Jun 3, 2024
@maelchiotti
Copy link
Owner

maelchiotti commented Jun 3, 2024

Thank you for reporting the issue.

I use the fleather library for the text editor, so I do not have direct control over this. However I agree that this white background is distracting.

I created an issue in the fleather repository, feel free to add a like reaction to it.

@simonbengtsson
Copy link

simonbengtsson commented Jun 5, 2024

Note that you can customize the style of code blocks yourself. In my notes app I wrap the fleather editor with the following theme which looks great in dark mode. Note that my app uses material3 so you might have to customize it to match your theming system.

class AppFleatherTheme extends StatelessWidget {
  final FleatherEditor editor;
  final bool secondary;

  const AppFleatherTheme(
      {super.key, required this.editor, required this.secondary});

  @override
  Widget build(BuildContext context) {
    final defaultTheme = FleatherThemeData.fallback(context);
    final textTheme = TextBlockTheme(
      style:
          secondary ? Style.secondaryText(context) : Style.primaryText(context),
      spacing: VerticalSpacing.zero(),
    );
    final linkTheme = defaultTheme.link.copyWith(color: textTheme.style.color!);

    final theme = Theme.of(context);
    final inlineCodeTheme = InlineCodeThemeData(
      backgroundColor: theme.colorScheme.surfaceContainer,
      radius: defaultTheme.inlineCode.radius,
      style: defaultTheme.inlineCode.style,
      heading1: defaultTheme.inlineCode.heading1,
      heading2: defaultTheme.inlineCode.heading2,
      heading3: defaultTheme.inlineCode.heading3,
    );

    final codeTheme = TextBlockTheme(
      style: defaultTheme.code.style,
      spacing: defaultTheme.code.spacing,
      decoration: defaultTheme.code.decoration!
          .copyWith(color: theme.colorScheme.surfaceContainerLowest),
    );

    return FleatherTheme(
      data: defaultTheme.copyWith(
        lists: textTheme,
        paragraph: textTheme,
        link: linkTheme,
        inlineCode: inlineCodeTheme,
        code: codeTheme,
      ),
      child: editor,
    );
  }
}

@maelchiotti
Copy link
Owner

Oh I did not know that @simonbengtsson, thank you. I will try it, if it works great it will be a perfect temporary fix until the fleather team address my issue.

@maelchiotti maelchiotti moved this from In progress to Next release in LocalMaterialNotes Jun 5, 2024
@maelchiotti maelchiotti moved this from Next release to In progress in LocalMaterialNotes Jun 7, 2024
@maelchiotti maelchiotti linked a pull request Jun 7, 2024 that will close this issue
@maelchiotti
Copy link
Owner

Hi @ego-lay-atman-bay, this is fixed by #85. It will be in the next release. Thank you for your tip @simonbengtsson!

@github-project-automation github-project-automation bot moved this from In progress to Done in LocalMaterialNotes Jun 7, 2024
@ego-lay-atman-bay
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
3 participants