Repository navigation
feat: Updated editor body colors (BLO-1232) (BLO-1240) (BLO-1331) #3206
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
Open
matthewlipski
wants to merge
4
commits into
a11y-testing
Choose a base branch
from
contrast-fixes
base: a11y-testing
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+368
−77
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
cfba314
Updated colors to hit contrast requirements
matthewlipski ce8024f
Updated color CSS variables to OKLCH color space and adjusted highlig…
matthewlipski 2b49035
Merge branch 'a11y-testing' into contrast-fixes
matthewlipski 73368ab
Untracked `highlight-color-comparison.html`
matthewlipski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "playground": true, | ||
| "docs": false, | ||
| "author": "", | ||
| "tags": ["Appearance & Styling"], | ||
| "dependencies": {}, | ||
| "pro": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Color combinations | ||
|
|
||
| Inspect every combination of the default text and background colors, including the default color, applied to whole blocks and inline content. Switch between light and dark themes to compare their appearance. | ||
|
|
||
| **Try me out!** Use the theme toggle above the editors. | ||
|
|
||
| ## Relevant docs | ||
|
|
||
| - [Themes](https://www.blocknotejs.org/docs/react/styling-theming/themes) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta | ||
| name="viewport" | ||
| content="width=device-width, initial-scale=1.0, interactive-widget=resizes-content" | ||
| /> | ||
| <title>Color combinations</title> | ||
| <script> | ||
| <!-- AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY --> | ||
| </script> | ||
| </head> | ||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" src="./main.tsx"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY | ||
| import React from "react"; | ||
| import { createRoot } from "react-dom/client"; | ||
| import App from "./src/App.jsx"; | ||
|
|
||
| const root = createRoot(document.getElementById("root")!); | ||
| root.render( | ||
| <React.StrictMode> | ||
| <App /> | ||
| </React.StrictMode>, | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| { | ||
| "name": "@blocknote/example-theming-color-combinations", | ||
| "description": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY", | ||
| "type": "module", | ||
| "private": true, | ||
| "version": "0.12.4", | ||
| "scripts": { | ||
| "start": "vite", | ||
| "dev": "vite", | ||
| "build:prod": "tsc && vite build", | ||
| "preview": "vite preview" | ||
| }, | ||
| "dependencies": { | ||
| "@blocknote/ariakit": "latest", | ||
| "@blocknote/core": "latest", | ||
| "@blocknote/mantine": "latest", | ||
| "@blocknote/react": "latest", | ||
| "@blocknote/shadcn": "latest", | ||
| "@mantine/core": "^9.0.2", | ||
| "@mantine/hooks": "^9.0.2", | ||
| "react": "^19.2.3", | ||
| "react-dom": "^19.2.3" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/react": "^19.2.3", | ||
| "@types/react-dom": "^19.2.3", | ||
| "@vitejs/plugin-react": "^6.0.1", | ||
| "vite": "^8.0.0" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import { COLORS_DEFAULT, type PartialBlock } from "@blocknote/core"; | ||
| import "@blocknote/core/fonts/inter.css"; | ||
| import { BlockNoteView } from "@blocknote/mantine"; | ||
| import "@blocknote/mantine/style.css"; | ||
| import { useCreateBlockNote } from "@blocknote/react"; | ||
| import { useState } from "react"; | ||
|
|
||
| const colors = ["default", ...Object.keys(COLORS_DEFAULT)]; | ||
| const blockColors: PartialBlock[] = colors.flatMap((backgroundColor) => [ | ||
| { | ||
| id: `block-heading-${backgroundColor}`, | ||
| type: "heading", | ||
| props: { level: 3 }, | ||
| content: `${backgroundColor} background`, | ||
| }, | ||
| ...colors.map((textColor) => ({ | ||
| id: `block-${backgroundColor}-${textColor}`, | ||
| type: "paragraph" as const, | ||
| props: { textColor, backgroundColor }, | ||
| content: `${textColor} text on ${backgroundColor} background`, | ||
| })), | ||
| ]); | ||
| const inlineColors: PartialBlock[] = colors.flatMap((backgroundColor) => [ | ||
| { | ||
| id: `inline-heading-${backgroundColor}`, | ||
| type: "heading", | ||
| props: { level: 3 }, | ||
| content: `${backgroundColor} background`, | ||
| }, | ||
| ...colors.map((textColor) => ({ | ||
| id: `inline-${backgroundColor}-${textColor}`, | ||
| type: "paragraph" as const, | ||
| content: [ | ||
| { type: "text" as const, text: "Inline: ", styles: {} }, | ||
| { | ||
| type: "text" as const, | ||
| text: `${textColor} text on ${backgroundColor} background`, | ||
| styles: { textColor, backgroundColor }, | ||
| }, | ||
| ], | ||
| })), | ||
| ]); | ||
|
|
||
| export default function App() { | ||
| const [theme, setTheme] = useState<"light" | "dark">("light"); | ||
| const blocks = useCreateBlockNote({ initialContent: blockColors }); | ||
| const inline = useCreateBlockNote({ initialContent: inlineColors }); | ||
|
|
||
| return ( | ||
| <div> | ||
| <button | ||
| type="button" | ||
| aria-pressed={theme === "dark"} | ||
| onClick={() => setTheme(theme === "light" ? "dark" : "light")} | ||
| > | ||
| Dark mode | ||
| </button> | ||
| <div | ||
| style={{ | ||
| display: "grid", | ||
| gridTemplateColumns: | ||
| "repeat(auto-fit, minmax(min(100%, 360px), 1fr))", | ||
| gap: 24, | ||
| }} | ||
| > | ||
| <section aria-label="Block color combinations"> | ||
| <h2>Block colors</h2> | ||
| <BlockNoteView editor={blocks} theme={theme} /> | ||
| </section> | ||
| <section aria-label="Inline color combinations"> | ||
| <h2>Inline colors</h2> | ||
| <BlockNoteView editor={inline} theme={theme} /> | ||
| </section> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "__comment": "AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY", | ||
| "compilerOptions": { | ||
| "target": "ESNext", | ||
| "useDefineForClassFields": true, | ||
| "lib": ["DOM", "DOM.Iterable", "ESNext"], | ||
| "allowJs": false, | ||
| "skipLibCheck": true, | ||
| "allowSyntheticDefaultImports": true, | ||
| "strict": true, | ||
| "forceConsistentCasingInFileNames": true, | ||
| "module": "ESNext", | ||
| "moduleResolution": "bundler", | ||
| "resolveJsonModule": true, | ||
| "isolatedModules": true, | ||
| "noEmit": true, | ||
| "jsx": "react-jsx", | ||
| "composite": true, | ||
| "paths": { | ||
| "@shared/*": ["../../../shared/*"] | ||
| } | ||
| }, | ||
| "include": ["."], | ||
| "__ADD_FOR_LOCAL_DEV_references": [ | ||
| { | ||
| "path": "../../../packages/core/" | ||
| }, | ||
| { | ||
| "path": "../../../packages/react/" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /// <reference types="vite/client" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| // AUTO-GENERATED FILE, DO NOT EDIT DIRECTLY | ||
| import react from "@vitejs/plugin-react"; | ||
| import * as fs from "fs"; | ||
| import * as path from "path"; | ||
| import { defineConfig } from "vite"; | ||
| // https://vitejs.dev/config/ | ||
| export default defineConfig(((conf: { command: string }) => ({ | ||
| plugins: [react()], | ||
| optimizeDeps: {}, | ||
| build: { | ||
| sourcemap: true, | ||
| }, | ||
| resolve: { | ||
| alias: | ||
| conf.command === "build" || | ||
| !fs.existsSync(path.resolve(__dirname, "../../packages/core/src")) | ||
| ? {} | ||
| : ({ | ||
| // The repo-wide alias for the shared test-utils directory (private, | ||
| // so it only resolves inside the monorepo). Harmless for examples | ||
| // that don't use it. | ||
| "@shared": path.resolve(__dirname, "../../../shared/"), | ||
| // Comment out the lines below to load a built version of blocknote | ||
| // or, keep as is to load live from sources with live reload working | ||
| "@blocknote/core": path.resolve( | ||
| __dirname, | ||
| "../../packages/core/src/", | ||
| ), | ||
| "@blocknote/react": path.resolve( | ||
| __dirname, | ||
| "../../packages/react/src/", | ||
| ), | ||
| } as any), | ||
| }, | ||
| })) as Parameters<typeof defineConfig>[0]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the hardcoded colors changed in this file actually be variables instead? Might be nice to clean up at same time