To customize an Astro theme, run it locally, then change things from the outside in: site settings and metadata first, then colours and fonts through the theme’s design tokens, then the logo and images, then navigation, and finally the content and pages. Working in that order means each change is small, easy to review, and unlikely to break the layout.
This guide uses the structure of a typical premium Astro theme, including the themes we sell: a complete Astro 7 project with TypeScript and Tailwind CSS. The same steps apply to free themes such as AstroWind or AstroPaper; only the file names differ.
Key Takeaways
- Run the theme locally first and commit the untouched version, so you always have a clean baseline to compare against.
- Change global settings (site URL, name, metadata) before touching any component.
- Colours and fonts should change in one place: the Tailwind config or CSS custom properties, not in individual components.
- Keep your content in collections and data files, and avoid editing layout files unless you need a structural change.
- Add the original theme repository as a Git remote so you can merge updates later.
Step 1: run the theme locally and commit a baseline
Clone the theme, install dependencies and start the dev server. For a theme delivered as a GitHub repository:
# Terminal
git clone [email protected]:your-org/your-theme.git my-site
cd my-site
npm install
npm run dev
Open http://localhost:4321 and click through every page. Before you change anything, commit the starting point in your own repository. Our getting started docs cover cloning and installing in more detail, including the Node.js version to use.
Then skim the project layout. Most Astro themes follow the same shape, explained in our folder structure docs:
src/
components/ reusable pieces: Header, Footer, Card, sections
content/ Markdown and MDX entries (blog, projects, menu)
layouts/ page shells that wrap every page
pages/ one file per route
styles/ global CSS and design tokens
data/ site settings, navigation, JSON data
public/ files served as-is: favicon, robots.txt, og images
astro.config.mjs
Step 2: change site settings and metadata
Start with the values that appear everywhere: the production URL, site name, default description and social links. Set site in the Astro config first, because canonical URLs, the sitemap and RSS feeds all depend on it:
// astro.config.mjs
import { defineConfig } from 'astro/config';
export default defineConfig({
site: 'https://www.example.com',
trailingSlash: 'always',
});
Many themes also keep a settings file for the brand name, contact details and social links. Look in src/data/, src/config.ts or src/site.config.ts. A typical one looks like this:
// src/data/site.ts
export const SITE = {
name: 'Northline Studio',
description: 'Brand and web design for independent hotels.',
email: '[email protected]',
social: {
linkedin: 'https://www.linkedin.com/company/example',
github: 'https://github.com/example',
},
};
Search the project for the demo brand name (grep -ri "demo name" src) to catch any copy that did not come from the settings file.
Step 3: change colours and fonts with design tokens
A well-built Astro theme defines colours and fonts once. Change them there, never by editing classes across dozens of components.
Colours in Tailwind CSS 3
If the theme uses Tailwind CSS 3, the palette lives in the Tailwind config. Replace the brand values and every component that uses bg-brand or text-brand updates:
// tailwind.config.mjs
/** @type {import('tailwindcss').Config} */
export default {
content: ['./src/**/*.{astro,html,js,ts,md,mdx}'],
theme: {
extend: {
colors: {
brand: {
DEFAULT: '#1f6f5c',
light: '#e6f2ef',
dark: '#134537',
},
ink: '#14181f',
},
},
},
};
Colours as CSS custom properties
Some themes use CSS variables instead, often so a dark mode can swap them. In that case, edit the variables in the global stylesheet:
/* src/styles/global.css */
:root {
--color-brand: #1f6f5c;
--color-surface: #ffffff;
--color-text: #14181f;
}
[data-theme='dark'] {
--color-brand: #5cc2a6;
--color-surface: #0f1316;
--color-text: #e8edf0;
}
Check contrast after every colour change. Text on your new brand colour needs a contrast ratio of at least 4.5:1 for body copy.
Fonts with the Astro Fonts API
Astro’s built-in Fonts API downloads and self-hosts fonts at build time and generates fallbacks to reduce layout shift. Register the font in the config:
// astro.config.mjs
import { defineConfig, fontProviders } from 'astro/config';
export default defineConfig({
site: 'https://www.example.com',
fonts: [
{
provider: fontProviders.fontsource(),
name: 'Inter',
cssVariable: '--font-sans',
weights: [400, 600, 700],
},
],
});
Then add the Font component to the head of your base layout and point the theme’s font family at the variable:
---
// src/layouts/Base.astro
import { Font } from 'astro:assets';
---
<html lang="en">
<head>
<Font cssVariable="--font-sans" preload />
</head>
<body style="font-family: var(--font-sans)">
<slot />
</body>
</html>
If the theme uses Tailwind, set fontFamily.sans to ['var(--font-sans)', 'system-ui', 'sans-serif'] in the config instead of the inline style. Our styling docs and the Astro fonts guide cover the remaining options.
Step 4: replace the logo, favicon and images
- Logo. Usually an SVG in
src/assets/or inline insrc/components/Header.astro. Replace the file, keep the same name, and check the header at mobile width. - Favicon. Replace
public/favicon.svg(and any PNG fallbacks). - Social image. Replace the default Open Graph image in
public/, usually 1200 by 630 pixels. - Content images. Put images used by components in
src/assets/and import them, soastro:assetscan optimise them. Files inpublic/are served untouched.
Search for demo image paths after replacing them, and give each new image accurate alt text.
Step 5: edit navigation and remove sections
Navigation is usually an array, either in the settings file or at the top of the header component:
// src/data/navigation.ts
export const NAV = [
{ label: 'Work', href: '/work/' },
{ label: 'Services', href: '/services/' },
{ label: 'Journal', href: '/journal/' },
{ label: 'Contact', href: '/contact/' },
];
To remove a homepage section, delete its component tag from src/pages/index.astro and its import. Leave the component file in place until you are sure you do not need it. To remove a whole page, delete the file in src/pages/, remove it from the navigation, and add a redirect in astro.config.mjs if the URL was ever public.
Step 6: replace demo content and add pages
Most of a theme’s copy lives in content collections (src/content/) and data files. Replace the demo entries with your own, keeping the frontmatter fields the schema in src/content.config.ts expects. If a field is wrong, the build tells you which file and which field.
To add a page, copy the closest existing page in src/pages/, rename it, and change the content. It will use the same layout and pick up your new colours and fonts automatically. Our Astro styling guide explains how scoped and global styles interact if a new page looks slightly off.
Step 7: keep receiving theme updates
If the theme came from a Git repository, add it as a second remote so you can pull fixes and Astro upgrades later:
# Terminal
git remote add upstream [email protected]:your-org/your-theme.git
git fetch upstream
git merge upstream/main
Merges are painless when your changes are concentrated in settings, tokens and content. They get painful when you have rewritten core layouts. That is the practical reason for customising from the outside in. Every Komal theme includes free lifetime updates delivered through its private repository, so this workflow is worth setting up on day one. If you have not picked a theme yet, you can browse Astro themes by category and preview each one live.
Before deploying, run npm run build and npm run preview to check the production output.
FAQ
Can I change everything in an Astro theme?
Yes. An Astro theme is a normal Astro project, so you own every file: layouts, components, styles and content. There is no locked editor. The only limits come from the licence, which may restrict reselling the theme itself.
How do I change the colours of an Astro theme?
Find where the theme defines its palette, usually tailwind.config.mjs for Tailwind themes or CSS custom properties in a global stylesheet, and change the brand values there. Every component that uses those tokens updates at once.
Do I need to know Astro to customize a theme?
For colours, text, images and navigation, basic HTML and CSS knowledge is enough, because most edits are in config and content files. Structural changes, such as new page types or content collections, are easier with some knowledge of Astro components and routing.
Will customizing a theme stop me from getting updates?
Not if you keep the original repository as a Git remote and merge updates into your copy. Conflicts are rare when your edits are in settings, design tokens and content, and more likely if you have heavily rewritten shared layouts.
How do I add a new page to an Astro theme?
Create a new .astro file in src/pages/; its path becomes the URL. The fastest way is to copy an existing page with a similar layout, then change the content and add the page to the navigation array.