# Design system

> Hasanat colours and type, how to apply them to the starter, and the design principles for Hasanat projects.

Source: https://platform.hasanat.dev/en/docs/services/design-system/

Hasanat's visual identity is calm and clear: emerald on a warm paper background, a small touch of gold, and one Arabic typeface. hasanat.dev, the project briefs, and this platform use it.

## Core colours

<ColorSwatches lang="en" set="brand" />

Emerald on paper has a contrast of about 5:1, and white text on emerald about 5.5:1, so both work for text. Gold on paper reaches only about 3:1, so never use it for text.

## Supporting colours

From the briefs' stylesheet:

<ColorSwatches lang="en" set="support" />

## Dark mode

In dark mode, this platform uses the dark-mode colours of the previous Hasanat site:

<ColorSwatches lang="en" set="dark" />

## Typeface

The typeface is **IBM Plex Sans Arabic**, under the SIL Open Font License. It covers both Arabic and Latin letters. This platform uses weights 400, 600, and 700.

- Self-host the font with your app, for example with the `@fontsource/ibm-plex-sans-arabic` package, instead of loading it from an external service.
- Give Arabic text a generous line height: 1.8 in the briefs and 1.85 on this platform.
- Never add letter spacing to Arabic text; it breaks the joined letters.
- Do not use italics for Arabic. The typeface has no italic styles.

## Applying it to the starter

The starter still uses an older palette (`#0f766e`) and the Inter and Noto Sans Arabic fonts from the `@fontsource/inter` and `@fontsource/noto-sans-arabic` packages. To apply the Hasanat identity:

1. Install the font, and remove the starter's fonts:

   ```sh
   npm install @fontsource/ibm-plex-sans-arabic
   npm uninstall @fontsource/inter @fontsource/noto-sans-arabic
   ```

2. At the top of `src/styles/global.css`, replace the `@fontsource` lines and the `@theme` values:

   ```css
   @import "@fontsource/ibm-plex-sans-arabic/400.css";
   @import "@fontsource/ibm-plex-sans-arabic/600.css";
   @import "@fontsource/ibm-plex-sans-arabic/700.css";
   @import "tailwindcss";

   @theme {
     --color-hasanat: #047857;
     --color-hasanat-light: #10b981;
     --color-hasanat-dark: #064e3b;
     --color-gold: #b8860b;
     --color-ink: #16271d;
     --color-surface: #f7f5ee;
     --color-surface-dark: #08110d;
     --font-sans: "IBM Plex Sans Arabic", system-ui, sans-serif;
   }
   ```

3. In the `base` layer of the same file, replace `text-slate-800` with `text-ink`.

We tried these changes on a copy of the starter, and the build passed.

The starter's ready-made `btn-primary` class picks up the emerald automatically, because it is built on the `hasanat` colour. `btn-secondary` and `card` use `slate` colours and white, so adjust them in the same file if you want.

## Principles

- **Arabic first:** right-to-left is the default. See [Arabic and RTL](/en/docs/services/arabic-and-rtl/).
- **Clarity over decoration:** one primary action per page, and short, clear text.
- **Real content:** design with the product's real text, not placeholder text. Do not put emoji in the interface.
- **Accessibility:** visible focus states, at least 4.5:1 contrast for normal text, full keyboard use, and labels for screen readers.
- **Mobile first:** check every page at 360px wide and with text zoomed to 200%.
- **Icons:** the starter uses `lucide-react`. Name meaningful icons, hide decorative ones from screen readers, and flip directional arrows in Arabic.
- **Dark mode is optional:** the starter does not include it by default.
