Skip to content

Commit 35ed19d

Browse files
Make the text white while in dark mode
1 parent 7c2fbc9 commit 35ed19d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

super_editor/example/lib/demos/example_editor/example_editor.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,16 @@ class _ExampleEditorState extends State<ExampleEditor> {
255255
_editorFocusNode.requestFocus();
256256
}
257257

258+
/// Makes text white, for use during dark mode styling.
259+
///
260+
/// This is the same behavior observed in Apple Notes.
261+
Color _darkModeSelectedColorStrategy({
262+
required Color originalTextColor,
263+
required Color selectionHighlightColor,
264+
}) {
265+
return Colors.white;
266+
}
267+
258268
@override
259269
Widget build(BuildContext context) {
260270
return ValueListenableBuilder(
@@ -397,6 +407,7 @@ class _ExampleEditorState extends State<ExampleEditor> {
397407
selectionColor: Colors.red.withOpacity(0.3),
398408
),
399409
stylesheet: defaultStylesheet.copyWith(
410+
selectedTextColorStrategy: isLight ? null : _darkModeSelectedColorStrategy,
400411
addRulesAfter: [
401412
if (!isLight) ..._darkModeStyles,
402413
taskStyles,

0 commit comments

Comments
 (0)