Files
supabase/apps/docs/features/ui/CodeBlock/CodeBlock.utils.ts
Charis 84914090f9 fix(docs): change code block theme (#34940)
Code block theme used Vitesse.

Code block theme uses the custom Supabase 2 theme, which matches the UI
library and design system sites.
2025-04-15 16:49:49 +00:00

31 lines
577 B
TypeScript

import { type CSSProperties } from 'react'
/*
* As defined in @shikijs/core/dist/chunk-tokens.d.mts
*/
enum FontStyle {
NotSet = -1,
None = 0,
Italic = 1,
Bold = 2,
Underline = 4,
}
export function getFontStyle(styleFlags: number): CSSProperties {
let style: CSSProperties = null
if (styleFlags & FontStyle.Italic) {
;(style ??= {}).fontStyle = 'italic'
}
if (styleFlags & FontStyle.Bold) {
;(style ??= {}).fontWeight = 'bold'
}
if (styleFlags & FontStyle.Underline) {
;(style ??= {}).textDecoration = 'underline'
}
return style
}