Skip to content

Commit 9e18ae6

Browse files
authored
Overhaul colour system & classes (#2783)
1 parent 9eca010 commit 9e18ae6

File tree

84 files changed

+881
-1014
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+881
-1014
lines changed

.changeset/friendly-seals-sip.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'gitbook': minor
3+
---
4+
5+
Overhaul colour scale & Tailwind colour classes

bun.lock

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@
6666
"openapi-types": "^12.1.3",
6767
"p-map": "^7.0.0",
6868
"parse-cache-control": "^1.0.1",
69-
"postcss-color-contrast": "^1.1.0",
7069
"react": "18.3.1",
7170
"react-dom": "18.3.1",
7271
"react-hotkeys-hook": "^4.4.1",
@@ -2558,8 +2557,6 @@
25582557

25592558
"postcss": ["[email protected]", "", { "dependencies": { "nanoid": "^3.3.7", "picocolors": "^1.1.0", "source-map-js": "^1.2.1" } }, "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ=="],
25602559

2561-
"postcss-color-contrast": ["[email protected]", "", { "dependencies": { "postcss-value-parser": "^4.2.0" }, "peerDependencies": { "postcss": "*" } }, "sha512-NYZcZf+D70RlM71cTBl7Vkz+ZmHY5iik0BXmG089GnVv0iAEODhXqQDdH8LVBPQANLKV/ZcW0y4nVtOoFk4d2g=="],
2562-
25632560
"postcss-import": ["[email protected]", "", { "dependencies": { "postcss-value-parser": "^4.0.0", "read-cache": "^1.0.0", "resolve": "^1.1.7" }, "peerDependencies": { "postcss": "^8.0.0" } }, "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew=="],
25642561

25652562
"postcss-js": ["[email protected]", "", { "dependencies": { "camelcase-css": "^2.0.1" }, "peerDependencies": { "postcss": "^8.4.21" } }, "sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw=="],

packages/gitbook/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
"openapi-types": "^12.1.3",
5050
"p-map": "^7.0.0",
5151
"parse-cache-control": "^1.0.1",
52-
"postcss-color-contrast": "^1.1.0",
5352
"react": "18.3.1",
5453
"react-dom": "18.3.1",
5554
"react-hotkeys-hook": "^4.4.1",

packages/gitbook/src/app/middleware/(site)/(content)/RocketLoaderDetector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export function RocketLoaderDetector(props: { nonce: string }) {
1515
document.addEventListener("DOMContentLoaded", () => {
1616
if (Array.from(document.scripts).find(script => script.src.includes('rocket-loader.min.js'))) {
1717
const alert = document.createElement('div');
18-
alert.className = 'p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400 mt-8 mx-8';
18+
alert.className = 'p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 mt-8 mx-8';
1919
alert.innerHTML = \`
2020
<strong>Error in site configuration:</strong>
2121
It looks like \${window.location.hostname} has been incorrectly configured in Cloudflare. This may lead to unexpected behavior or issues with the page loading. If you are the owner of this site, please refer to <a href="https://docs.gitbook.com/published-documentation/custom-domain/configure-dns#are-you-using-cloudflare" class="underline">GitBook's documentation</a> for steps to fix the problem.

packages/gitbook/src/app/middleware/(site)/(core)/~gitbook/icon/route.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export async function GET(req: NextRequest) {
4848
return new ImageResponse(
4949
(
5050
<div
51-
tw={tcls(options.theme === 'light' ? 'bg-white' : 'bg-gray-900', size.boxStyle)}
51+
tw={tcls(options.theme === 'light' ? 'bg-white' : 'bg-black', size.boxStyle)}
5252
style={{
5353
width: '100%',
5454
height: '100%',
@@ -62,7 +62,7 @@ export async function GET(req: NextRequest) {
6262
size.textSize,
6363
'font-bold',
6464
'tracking-tight',
65-
options.theme === 'light' ? 'text-gray-900' : 'text-white',
65+
options.theme === 'light' ? 'text-black' : 'text-white',
6666
)}
6767
>
6868
{'emoji' in customization.favicon

packages/gitbook/src/app/middleware/(site)/(core)/~gitbook/ogimage/[pageId]/route.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import { CustomizationHeaderPreset } from '@gitbook/api';
22
import { redirect } from 'next/navigation';
33
import { ImageResponse } from 'next/og';
44
import { NextRequest } from 'next/server';
5-
import colorContrast from 'postcss-color-contrast/js';
65
import React from 'react';
76

87
import { googleFontsMap } from '@/fonts';
8+
import { colorContrast } from '@/lib/colors';
99
import { getAbsoluteHref } from '@/lib/links';
1010
import { filterOutNullable } from '@/lib/typescript';
1111
import { getContentTitle } from '@/lib/utils';

packages/gitbook/src/app/middleware/(space)/~gitbook/pdf/PageControlButtons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export function PageControlButtons(props: {
133133
'items-center',
134134
'justify-center',
135135
'text-lg',
136-
'text-dark/6',
136+
'text-tint',
137137
'px-6',
138138
'py-2',
139139
'bg-slate-100',

packages/gitbook/src/app/middleware/(space)/~gitbook/pdf/page.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,9 @@ export default async function PDFHTMLOutput(props: {
9797
'items-center',
9898
'justify-center',
9999
'text-sm',
100-
'text-dark/6',
100+
'text-tint',
101101
'hover:text-primary',
102102
'p-4',
103-
'dark:text-light/5',
104103
'rounded-full',
105104
'bg-white',
106105
'shadow-sm',
@@ -123,10 +122,9 @@ export default async function PDFHTMLOutput(props: {
123122
'items-center',
124123
'justify-center',
125124
'text-sm',
126-
'text-dark/6',
125+
'text-tint',
127126
'hover:text-primary',
128127
'p-4',
129-
'dark:text-light/5',
130128
'rounded-full',
131129
'bg-white',
132130
'shadow-sm',

packages/gitbook/src/components/AdminToolbar/AdminToolbar.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ function ToolbarLayout(props: { children: React.ReactNode }) {
2626
'transform',
2727
'-translate-x-1/2',
2828
'rounded-full',
29-
'bg-dark-1/9',
29+
30+
'bg-tint-12/9',
31+
'dark:bg-tint-1/9',
32+
3033
'shadow-lg',
3134
'min-h-10',
3235
'min-w-40',
3336
'p-2',
3437
'max-w-md',
35-
'border-dark-1',
36-
'backdrop-blur-sm',
38+
'border-tint-12/1',
39+
'backdrop-blur-md',
3740
)}
3841
>
3942
<React.Suspense fallback={null}>{props.children}</React.Suspense>
@@ -88,7 +91,7 @@ async function ChangeRequestToolbar(props: { spaceId: string; changeRequestId: s
8891
<p>
8992
#{changeRequest.number}: {changeRequest.subject ?? 'No subject'}
9093
</p>
91-
<p className="text-xs text-light/8 dark:text-light/8">
94+
<p className="text-xs text-tint-2 dark:text-tint-11">
9295
Change request updated <DateRelative value={changeRequest.updatedAt} />
9396
</p>
9497
</ToolbarBody>
@@ -126,7 +129,7 @@ async function RevisionToolbar(props: { spaceId: string; revisionId: string }) {
126129
Revision created <DateRelative value={revision.createdAt} />
127130
</p>
128131
{revision.git ? (
129-
<p className="text-xs text-light/8 dark:text-light/8">
132+
<p className="text-xs text-tint-2 dark:text-tint-11">
130133
{revision.git.message}
131134
</p>
132135
) : null}

packages/gitbook/src/components/AdminToolbar/Toolbar.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ export function Toolbar(props: { children: React.ReactNode }) {
1919
'py-1',
2020
'rounded-full',
2121
'truncate',
22-
'text-light',
23-
'dark:text-light',
22+
'text-tint-1',
23+
'dark:text-tint-12',
2424
)}
2525
>
2626
{children}
@@ -50,12 +50,11 @@ export function ToolbarButton(props: React.HTMLProps<HTMLAnchorElement>) {
5050
'gap-1',
5151
'text-sm',
5252
'rounded-full',
53-
'hover:bg-dark-1',
54-
'hover:text-white',
5553
'truncate',
56-
'text-light',
57-
'dark:text-light',
58-
'dark:hover:bg-dark-2',
54+
'text-tint-1', // Equal to text-tint-strong in dark mode
55+
'dark:text-tint-12', // Equal to text-tint-strong in dark mode
56+
'hover:bg-tint-12',
57+
'dark:hover:bg-tint-1',
5958
'hover:shadow-lg',
6059
'cursor-pointer',
6160
)}

0 commit comments

Comments
 (0)