Skip to content
Available for new work
Pages in Blog

GuidePremium

Tokens, theming and the article layout in CoullWorks Blog for Laravel

Change colours, type and spacing through the --cw CSS variables, switch dark mode, and understand the article grid (rail 285, gap 60, body 672) that every front end shares.

Updated 16 November 2026Back to the package pageBuy

Every HTML front end (Blade with Tailwind or Bootstrap, Livewire and Inertia with React or Vue) is styled from one set of CSS custom properties, the --cw-* tokens, and one stylesheet, blog.css. Change a token and every page follows. You do not edit a view to re-colour the blog.

The files#

FileWhat it is
tokens.cssThe only file with colour values, plus the type scale, spacing, radii, shadows, motion, breakpoints and the article measures. Light colours on :root, dark colours below them
blog.cssThe article grid, the rail, the cards, the listing, the blocks and the comments, all written from the tokens. It has no colour values of its own
adapter-tailwind.cssMaps the tokens into your Tailwind 4 @theme so utilities such as bg-cw-accent resolve to var(--cw-accent)
adapter-bootstrap.cssLets Bootstrap's own --bs-* variables drive the tokens, so data-bs-theme="dark" works
dist/blog-tailwind.css, dist/blog-bootstrap.cssThe compiled stylesheets the default layout links: the view set's classes plus all four files above

Publish the token file and blog.css with php artisan vendor:publish --tag=cwb-blade-tokens (to public/vendor/coullworks-blog/). Publish the adapters with --tag=cwb-blade-adapters. For Inertia the installer already puts the same files in resources/js/blog/styles.

Change a colour or a size#

  1. Run php artisan vendor:publish --tag=cwb-blade-tokens. This writes public/vendor/coullworks-blog/tokens.css.
  2. Open that file and change the value you want, for example --cw-accent: #BC3F0C; to your brand colour.
  3. Reload the blog. When the compiled stylesheet is in use, the default layout links your published tokens.css after it, so your values win. When blade.compiled_css is false, the layout links tokens.css and blog.css directly.
  4. Change the dark value too: it is in the @media (prefers-color-scheme: dark) block and the [data-theme="dark"] block of the same file. Edit both so automatic and forced dark mode agree.

Run vendor:publish again with --force only if you want to throw your edits away. After a package update, compare your file with the new one, because new tokens may have been added.

The article with the contents rail: On this page, Key takeaways and About the authors in a left column, the text on the right

Every colour here (the pale grey ground, the dark text, the hairline borders of the contents box) comes from the tokens below, and every size from the type tokens.

Colour tokens#

TokenLightDarkUsed for
--cw-ground#F4F5F6#0E0E10The page background
--cw-raised#FFFFFF#141417The header, footer and raised panels
--cw-panel#EAECEE#1C1C21Quiet panels, hover fills, notices
--cw-rule#DADDE0#2B2B31Hairlines
--cw-rule-strong#7E868D#6A6A72Input borders and stronger lines
--cw-heading#111417#F2F4F6Headings
--cw-text#1F2429#D5DADEBody text
--cw-muted#5A636B#9A9AA1Dates, captions, secondary text
--cw-accent#BC3F0C#FF6A1FLinks and buttons
--cw-accent-ink#FFFFFF#140800Text on an accent button
--cw-focus#BC3F0C#FF6A1FThe keyboard focus ring
--cw-good, --cw-warn, --cw-bad#15703F, #8A5200, #B3261E#4ADE80, #FBBF24, #F87171Success, warning and error text

Type, spacing and shape tokens#

TokenDefaultUsed for
--cw-font-body, --cw-font-display, --cw-font-monosystem sans, the body font, system monoBody, headings and code
--cw-text-xs to --cw-text-3xl0.75rem, 0.875rem, 1rem, 1.125rem, 1.375rem, 1.75rem, 2.5remThe general scale
--cw-leading-body, --cw-leading-display1.75, 1.1Line heights
--cw-text-reading1.0625rem (17px)Article body text
--cw-leading-reading1.7Article body line height
--cw-font-readingthe body fontSet a serif here to change the article text without touching a view
--cw-text-h1-articleclamp(2rem, 1rem + 3.2vw, 3.5rem)The article title: 32px on a phone up to 56px
--cw-weight-display700The weight of titles
--cw-text-h2, --cw-weight-h2clamp(1.5rem, 1.25rem + 0.8vw, 2rem), 600Section headings in the text
--cw-text-h31.25remSub-headings
--cw-text-dek1.25remThe standfirst under the title
--cw-flow1.125remThe space between paragraphs
--cw-space-1 to --cw-space-160.25rem to 4remSpacing
--cw-radius-sm, -md, -lg, -full2px, 6px, 12px, 999pxCorner rounding
--cw-shadow-sm, --cw-shadow-mdsoft shadowsCards and popovers
--cw-duration-fast, --cw-duration-base, --cw-ease120ms, 200ms, ease-outMotion. It is switched off for readers who ask for reduced motion
--cw-bp-sm, -md, -lg, -xl640px, 768px, 1024px, 1280pxThe breakpoints the layout uses
--cw-target-min24pxThe smallest tap target
--cw-gutter1rem, 1.5rem from 640pxThe side margin of the page

Dark mode#

Dark mode needs no setting. The tokens switch in three ways.

  • Automatic. The reader's system asks for dark (prefers-color-scheme: dark), unless the page says otherwise.
  • Forced dark. Put data-theme="dark" (or Bootstrap's data-bs-theme="dark") on <html> or any wrapping element.
  • Forced light. Put data-theme="light" or data-bs-theme="light" on <html>. This stops the automatic switch.

To build a toggle on your site, set the attribute from your own script and remember the choice in a cookie or localStorage. With Bootstrap, the same data-bs-theme attribute also switches Bootstrap's own components.

The article layout#

The article page is laid out by blog.css from tokens, not by utility classes in the views, so Blade (Tailwind and Bootstrap), Livewire, Inertia and the headless sample draw the same page. The views carry only data-cw hooks in this region.

MeasureTokenValue
Rail width--cw-rail-width285px
Gap between rail and text--cw-rail-gap60px
Text column--cw-measure672px
Article container--cw-article1017px (rail + gap + text), centred
Page width--cw-page1152px

An article scrolled to its third section: the current entry in the rail is bold with an orange bar

The rail follows the reader. It is sticky as the page scrolls, and the entry for the section on screen, "Weight, packed size and the poles", is bold with an orange bar on its left. Sub-headings (Pole sleeves and clips, Pole material) are indented under it. Below the contents, Key takeaways and About the authors.

Beside the rail the article is one grid: a 285px rail, a 60px gap and a 672px body. The head (kicker, title, standfirst, byline), the hero image and the rail start at the same left edge. Without a rail, the head, the body and the contents are one 672px column and the hero keeps the article width. Wide and full figures are clamped to the body column when the rail is on, and may bleed to the article width without it.

An article on a phone: one column, contents as a box in the text

The top of the same article at 390 pixels. There is no rail: the breadcrumb, title, standfirst, byline and hero image run in one column, then a contents box and the Key takeaways sit in the text.

Below 1024px the rail is hidden and its content moves into the page: the contents become a disclosure, the key takeaways stay in the text, share links sit under the text, and the author box and the related grid follow the body.

Rail or no rail#

Each post has a layout, chosen in the post editor: Article (no rail, the author box below the text) or Article with rail. A post left on Blog default follows the setting template.default, which you change in Settings. Until that setting has been saved, the blade.rail config key decides. The rail shows only the sections that have content, in this order: On this page (the h2 and h3 headings), Key takeaways (the post's first takeaways block), the authors with share links, and Related posts (up to three). With every section empty there is no rail.

Section order on the page#

Breadcrumbs, category kicker, title, standfirst (the excerpt, when set), byline, hero image, rail and text, the post-cta slot, tags, previous and next, the author box, related posts, then the post-after-content slot, where comments appear. The slots are explained in Views you can override.

Listing layout#

The first featured post is a wide lead card (image about 60 percent of the width), then a grid of cards: three columns from 1024px, two from 640px, one below. A card has a 3:2 image, a 22px title, a three-line excerpt and a meta row. An author page shows a 96px avatar, the role and the bio above the grid. The Products block's grid is one column on a phone and two from 640px.

Inertia and shadcn#

In an Inertia app that uses a shadcn theme, point the tokens at its variables in your own CSS instead of editing the published file, for example :root { --cw-accent: var(--primary); --cw-ground: var(--background); --cw-text: var(--foreground); }, and the same under .dark.

Available for new work

UK based · PHP · Python · JS · TS. Every first call is free.