Documentation website for the @sardine/colour JavaScript utility library for colour manipulation.
This is the official documentation site for @sardine/colour, a tiny JavaScript utility library that provides functions for colour conversion, manipulation, and analysis. The site features interactive documentation with live code examples and playground demos.
Live Site: colour.sardine.dev
- Framework: Astro - Static site generator
- Styling: Tailwind CSS - Utility-first CSS framework
- Content: Astro Content Collections - Type-safe content management
- Syntax Highlighting: Shiki with Dracula theme
- Deployment: Netlify - Static hosting with CDN
- Language: TypeScript with strict mode
/
├── src/
│ ├── components/
│ │ └── Navigation.astro # Dynamic navigation component
│ ├── content.config.ts # Content collection schemas
│ ├── docs/ # Documentation markdown files
│ │ ├── convertHextoRGB.md # Function documentation
│ │ ├── findNearestColour.md # Function documentation
│ │ └── ... # More function docs
│ ├── layouts/
│ │ └── BaseLayout.astro # Root layout with global styles
│ ├── pages/
│ │ ├── index.astro # Homepage
│ │ └── docs/[slug].astro # Dynamic documentation pages
│ └── styles/
│ └── global.css # Global styles and CSS variables
├── public/
│ ├── playground/ # Interactive demo HTML files
│ │ ├── convertHextoRGB.html # Live function demos
│ │ └── ... # More playground files
│ ├── icons/ # Favicons and logos
│ └── fonts/ # Web fonts (Fira Mono)
├── astro.config.mjs # Astro configuration
├── netlify.toml # Netlify deployment config
└── tsconfig.json # TypeScript configuration
- Clone the repository
git clone https://github.com/sardinedev/colour.sardine.dev.git
cd colour.sardine.dev- Set the correct Node.js version
nvm use- Install dependencies
npm install- Start development server
npm run devOpen http://localhost:4321 in your browser.
| Command | Description |
|---|---|
npm run dev |
Start development server at localhost:4321 |
npm run build |
Build production site to ./dist/ |
npm run preview |
Preview production build locally |
npm run astro |
Run Astro CLI commands |
-
Create a new markdown file in
src/docs/:touch src/docs/yourFunctionName.md
-
Add required frontmatter:
--- title: Your Function Name tags: converters # or "utility functions" description: Brief description of what the function does --- ## Description Detailed explanation of the function...
-
Navigation updates automatically via Astro content collections.
- Tags: Use either
"converters"or"utility functions"for proper navigation grouping - Code Examples: Include practical JavaScript examples with expected outputs
- Playground: Consider adding an interactive demo in
public/playground/
The site includes interactive demos for testing functions live in the browser:
- Located in
public/playground/*.html - Self-contained HTML files with inline styles and scripts
- Import
@sardine/colourfrom unpkg CDN - Consistent dark theme with error handling
- Create an HTML file in
public/playground/ - Import the library:
import { yourFunction } from "https://unpkg.com/@sardine/colour@latest/dist/index.min.js" - Follow existing playground patterns for styling and functionality
- Link to it from your documentation markdown
The site is automatically deployed to Netlify:
- Trigger: Commits to
mainbranch - Build Command:
npm run build - Output Directory:
dist/ - Domain: colour.sardine.dev
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Test locally with
npm run build && npm run preview - Submit a pull request
For major changes, please open an issue first to discuss what you would like to change.
- Library Repository: github.com/sardinedev/colour
- NPM Package: @sardine/colour
- Documentation Site: colour.sardine.dev