@getblock/core
v0.0.88
Published
## Theming
Readme
@getblock/core
Theming
Import the stylesheet once in the app entry:
import '@getblock/core/styles';Every colour in the package resolves through a custom property. The properties are declared once,
and both layers read them: the gb-* utility classes, and the components' own styles.
:root {
--gb-text-main: #1E1E1F; /* light value */
--gb-text-dark-main: #FFFFFF; /* dark value, where a token has one */
}
.gb-text-text-main { color: var(--gb-text-main); }
.dark .gb-text-text-main { color: var(--gb-text-dark-main); }Each property is a constant — --gb-text-main is always the light value and --gb-text-dark-main
always the dark one. Nothing flips with the theme, because the Tailwind classes that read them do
not flip either: text-text-main and text-text-dark-main are separate classes, combined by the
caller as text-text-main dark:text-text-dark-main. Only the gb-* utilities are theme-aware, and
they express it by pointing their .dark rule at the dark property.
Property names are the token's own path: --gb-bg-base, --gb-text-secondary,
--gb-button-accent-hover, --gb-border-dark-focus.
Retheming from the host application
Redeclare any property after the package's stylesheet:
/* app entry, imported after '@getblock/core/styles' */
:root {
--gb-text-action: #1A5FD4; /* your accent */
--gb-surface-additional: #F7F8FA;
}This reaches both layers: your own markup wherever it carries a gb-* class, and the components
this package exports. tailwind.config.cjs resolves its colours to the same properties, so
@apply bg-surface-additional inside GetBlockUIInput's CSS module compiles to
background: var(--gb-surface-additional) — an override repaints the input without a fork, a release,
or a version pin.
Two consequences worth knowing.
Overriding a light property alone leaves dark mode untouched, since the dark values live in their own
properties: pair --gb-text-action with --gb-text-dark-action when both themes matter.
And an override reaches every use of that token, components included. Restyling one screen is a job for your own classes, not for a property — the properties are the palette, not a local escape hatch.
Dark mode follows the .dark class on an ancestor — usually <html>.
Values that must stay identical across GetBlock products (accent, ink ramp, status colours, typeface) are listed in
BRAND_CORE.md. Retheme freely outside that list.
Vue 3 + TypeScript + Vite
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 <script setup> SFCs, check out the script setup docs to learn more.
Recommended IDE Setup
Type Support For .vue Imports in TS
Since TypeScript cannot handle type information for .vue imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in .vue imports (for example to get props validation when using manual h(...) calls), you can enable Volar's Take Over mode by following these steps:
- Run
Extensions: Show Built-in Extensionsfrom VS Code's command palette, look forTypeScript and JavaScript Language Features, then right click and selectDisable (Workspace). By default, Take Over mode will enable itself if the default TypeScript extension is disabled. - Reload the VS Code window by running
Developer: Reload Windowfrom the command palette.
You can learn more about Take Over mode here.
