Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat: add syntax highlighting for code blocks

Harsh Karande34e40694db0f
diff --git a/studio/components/to-be-cleaned/Docs/Param.js b/studio/components/to-be-cleaned/Docs/Param.js
index b04d0ad0b17..ecdd172b5ca 100644
--- a/studio/components/to-be-cleaned/Docs/Param.js
+++ b/studio/components/to-be-cleaned/Docs/Param.js
@@ -22,7 +22,7 @@ const Param = ({
{format && format != type && (
<div className="mb-4">
<h5 className="uppercase text-xs font-medium text-gray-400">Format</h5>
- <code className="p-0 text-sm bg-gray-700">{format}</code>
+ <code className="p-0 text-sm bg-white dark:bg-gray-700">{format}</code>
</div>
)}
{description !== false && (
diff --git a/studio/pages/project/[ref]/api/index.tsx b/studio/pages/project/[ref]/api/index.tsx
index fd73c2c0999..49d594eb92c 100644
--- a/studio/pages/project/[ref]/api/index.tsx
+++ b/studio/pages/project/[ref]/api/index.tsx
@@ -134,8 +134,8 @@ const DocView: FC<any> = observer(({}) => {
className={`${
selectedLang == 'js'
? 'text-gray-600 dark:text-gray-300'
- : 'text-gray-400 dark:text-gray-400'
- } relative inline-flex items-center p-1 px-2 bg-gray-100 dark:bg-gray-600 border-r border-gray-200 dark:border-gray-500 text-sm font-medium hover:text-gray-600 dark:hover:text-gray-300 focus:z-10 focus:outline-none focus:border-blue-300 focus:ring-blue active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150`}
+ : 'text-gray-300 dark:text-gray-400'
+ } relative inline-flex items-center p-1 px-2 bg-coolGray-100 dark:bg-gray-600 border-r border-gray-200 dark:border-gray-500 text-sm font-medium hover:text-gray-600 dark:hover:text-gray-300 focus:z-10 focus:outline-none focus:border-blue-300 focus:ring-blue active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150`}
>
JavaScript
</button>
@@ -145,16 +145,16 @@ const DocView: FC<any> = observer(({}) => {
className={`${
selectedLang == 'bash'
? 'text-gray-600 dark:text-gray-300'
- : 'text-gray-400 dark:text-gray-400'
- } relative inline-flex items-center p-1 px-2 bg-gray-100 dark:bg-gray-600 border-r border-gray-200 dark:border-gray-500 text-sm font-medium hover:text-gray-600 dark:hover:text-gray-300 focus:z-10 focus:outline-none focus:border-blue-300 focus:ring-blue active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150`}
+ : 'text-gray-300 dark:text-gray-400'
+ } relative inline-flex items-center p-1 px-2 bg-coolGray-100 dark:bg-gray-600 border-r border-gray-200 dark:border-gray-500 text-sm font-medium hover:text-gray-600 dark:hover:text-gray-300 focus:z-10 focus:outline-none focus:border-blue-300 focus:ring-blue active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150`}
>
Bash
</button>
{selectedLang == 'bash' && (
<div className="flex">
- <span className="text-sm text-gray-300 p-1 pl-2">Key:</span>
+ <span className="text-sm text-gray-600 dark:text-gray-300 p-1 pl-2">Key:</span>
<select
- className="text-sm text-gray-300 border-none cursor-pointer p-0 pl-2 pr-8"
+ className="text-sm text-gray-600 dark:text-gray-300 border-none cursor-pointer p-0 pl-2 pr-8"
value={showApiKey}
onChange={(e) => setShowApiKey(e.target.value)}
>
@@ -339,7 +339,7 @@ const ResourceContent = ({
return (
<>
- <h2 className="text-white mt-0">
+ <h2 className="text-black dark:text-white mt-0">
<code className="text-lg px-4 py-2">{resourceId}</code>
</h2>
diff --git a/studio/styles/code.scss b/studio/styles/code.scss
index 991d786f761..e55d2078a94 100644
--- a/studio/styles/code.scss
+++ b/studio/styles/code.scss
@@ -14,10 +14,15 @@
@apply text-sm;
}
+ .token.imports,
+ .token.property-access {
+ @apply text-blueGray-500 dark:text-blueGray-300 #{!important};
+ }
+
.token.keyword.module,
.token.function {
font-style: normal !important;
- color: #ccc !important;
+ @apply text-gray-600 dark:text-gray-300 #{!important};
}
.token.plain,
@@ -30,42 +35,42 @@
.token.doc-comment.parameter.punctuation,
.token.doc-comment.optional-parameter.punctuation {
font-style: normal !important;
- color: #ccc !important;
+ @apply text-gray-600 dark:text-gray-300 #{!important};
}
.token.keyword,
.token.doc-comment.keyword {
font-style: normal !important;
- color: #569cd6 !important;
+ @apply text-blue-600 dark:text-blue-300 #{!important};
}
.token.string {
font-style: normal !important;
- color: #24b47e !important;
+ @apply text-green-500 #{!important};
}
.token.console {
font-style: normal !important;
- color: #49c1ad !important;
+ @apply text-teal-600 dark:text-teal-400 #{!important};
}
.token.constant {
font-style: normal !important;
- color: #569cd6 !important;
+ @apply text-blue-600 dark:text-blue-300 #{!important};
}
.token.comment {
font-style: normal !important;
- color: #666 !important;
+ @apply text-gray-300 dark:text-gray-400 #{!important};
}
.token.number {
- color: #b5cea8 !important;
+ @apply text-green-600 dark:text-green-200 #{!important};
}
.token.boolean,
.token.doc-comment.class-name {
- @apply text-green-500;
+ @apply text-green-500 dark:text-green-500;
}
.codeBlock {
diff --git a/studio/styles/ui.scss b/studio/styles/ui.scss
index f924e6971ae..c60a07ea991 100644
--- a/studio/styles/ui.scss
+++ b/studio/styles/ui.scss
@@ -195,12 +195,12 @@ label:not(.sbui-formlayout__label):not(.sbui-checkbox__label-container__label):n
/* Docs */
.Docs {
&--inner-wrapper {
- background: linear-gradient(90deg, #ffffff 50%, #eeeeee 50%);
+ background: linear-gradient(90deg, #ffffff 50%, #f3f4f6 50%); /* bg-white bg-coolGray-100 */
width: 100%;
}
.dark &--inner-wrapper {
- background: linear-gradient(90deg, #1f1f1f 50%, #2a2a2a 50%);
+ background: linear-gradient(90deg, #1f1f1f 50%, #2a2a2a 50%); /* bg-gray-700 bg-gray-600 */
}
h1,
diff --git a/studio/tailwind.config.js b/studio/tailwind.config.js
index 3c8f4584372..d70ade40702 100644
--- a/studio/tailwind.config.js
+++ b/studio/tailwind.config.js
@@ -48,6 +48,19 @@ const coolGray = {
900: '#111827',
}
+const teal = {
+ 50: '#f0fdfa',
+ 100: '#ccfbf1',
+ 200: '#99f6e4',
+ 300: '#5eead4',
+ 400: '#2dd4bf',
+ 500: '#14b8a6',
+ 600: '#0d9488',
+ 700: '#0f766e',
+ 800: '#115e59',
+ 900: '#134e4a',
+}
+
module.exports = {
mode: 'jit',
darkMode: 'class', // or 'media' or 'class'
@@ -77,6 +90,7 @@ module.exports = {
green: { ...green },
blueGray: { ...blueGray },
coolGray: { ...coolGray },
+ teal: { ...teal },
/* typography */
'typography-body': {