Style System

The django-logikal components are based on a flexible style system, which can be modified to the needs of any project. Development will typically start with adjusting the typography and colors to follow the appropriate brand guidelines. The default values for the layout variables should already be sufficient for most projects, however, adjustments can be made when necessary.

Tip

Remember that you can always override any style in your own style sheets. However, the standard values are a result of a meticulous design process, so make sure to do any adjustments with great care for usability and a relentless focus on good design principles.

Typography

Font Families

A font family is typically a collection of fonts, often organized by weight (e.g. light, regular, bold, heavy) and style (e.g. italic, regular). The style system ships with the following default font families:

Font families
  • --font-family-display: "django-logikal-cooper-hewitt", sans-serif;

  • --font-family-text: "django-logikal-lato", sans-serif;

  • --font-family-text-monospace: "django-logikal-roboto-mono", monospace;

Font Theme

The font theme defines the individual semantic font roles that can be used during development, including the size, leading, weight and style of a font in a given role.

Important

Font sizing and leading variables should only be used in the definition of the semantic font roles – they should never be used directly in CSS declarations.

For reference, the style system’s default font sizing and leading definitions and semantic font roles are as follows:

Font sizing
Heading sizes
  • --font-size-title: 2.75rem;

  • --font-leading-title: 3rem;


  • --font-size-subtitle: 1.75rem;

  • --font-leading-subtitle: 2.25rem;


  • --font-size-heading: 1.75rem;

  • --font-leading-heading: 2.25rem;


  • --font-size-subheading: 1.25rem;

  • --font-leading-subheading: 1.75rem;

Body sizes
  • --font-size-body: 1.25rem;

  • --font-leading-body: 1.75rem;


  • --font-size-body-caption: 1.125rem;

  • --font-leading-body-caption: 1.75rem;


  • --font-size-body-code: 1.125rem;

  • --font-leading-body-code: 1.75rem;

Font metric corrections
  • --font-button-icon-text-vertical-shift: 0.0625rem;

Font theme
Heading fonts
  • --theme-font-title: var(--font-size-title)/var(--font-leading-title) var(--font-family-display);

  • --theme-font-subtitle: italic var(--font-size-subtitle)/var(--font-leading-subtitle) var(--font-family-display);

  • --theme-font-heading: 600 var(--font-size-heading)/var(--font-leading-heading) var(--font-family-display);

  • --theme-font-subheading: bold var(--font-size-subheading)/var(--font-leading-subheading) var(--font-family-display);

Body fonts
  • --theme-font-body: var(--font-size-body)/var(--font-leading-body) var(--font-family-text);

  • --theme-font-body-emphasis: bold var(--font-size-body)/var(--font-leading-body) var(--font-family-text);

  • --theme-font-body-caption: var(--font-size-body-caption)/var(--font-leading-body-caption) var(--font-family-text);

  • --theme-font-body-code: var(--font-size-body-code)/var(--font-leading-body-code) var(--font-family-text-monospace);

Color

Color Palette

The color palette is the set of colors available in a given project.

The django-logikal component system comes with a standard light and dark color palette based on our company design system, however, projects will typically want to use their own color palette, and overwrite the color theme declarations as necessary.

Important

The individual colors should never be used directly in a design – instead, they should be assigned to a semantic role (via the color theme), and the semantic role should be used in the actual CSS declarations.

For reference, the color palette shipping with the component system is as follows:

Color palette (light mode)
Primary colors
  • --color-magic-purple: #622ade;

  • --color-deep-blue: #060338;

  • --color-black: #000000;

  • --color-white: #ffffff;

Accent colors
  • --color-bright-teal: #00b9af;

  • --color-bright-blue: #5591c9;

  • --color-bright-pink: #ff6b97;

  • --color-bright-purple: #b195ef;

Supporting colors
  • --color-solid-purple: #7562af;

  • --color-solid-gray: #7f7f7f;

  • --color-light-gray: #f1f1f1;

Derived colors
Surfaces
  • --color-lightness-surface-highlight: 0.04;

  • --color-lightness-surface-hit: -0.04;


  • --color-magic-purple-surface-highlight: oklch(from var(--color-magic-purple) calc(l + var(--color-lightness-surface-highlight)) c h);

  • --color-magic-purple-surface-hit: oklch(from var(--color-magic-purple) calc(l + var(--color-lightness-surface-hit)) c h);


  • --color-bright-pink-surface-highlight: oklch(from var(--color-bright-pink) calc(l + var(--color-lightness-surface-highlight)) c h);

  • --color-bright-pink-surface-hit: oklch(from var(--color-bright-pink) calc(l + var(--color-lightness-surface-hit)) c h);

Content
  • --color-lightness-content-highlight: 0.1;

  • --color-lightness-content-hit: -0.1;


  • --color-magic-purple-content-highlight: oklch(from var(--color-magic-purple) calc(l + var(--color-lightness-content-highlight)) c h);

  • --color-magic-purple-content-hit: oklch(from var(--color-magic-purple) calc(l + var(--color-lightness-content-hit)) c h);

Color palette (dark mode)
Primary colors
  • --color-magic-purple: #622ade;

  • --color-deep-blue: #060338;

  • --color-black: #000000;

  • --color-white: #ffffff;

Accent colors
  • --color-bright-teal: #00b9af;

  • --color-bright-blue: #5591c9;

  • --color-bright-pink: #ff6b97;

  • --color-bright-purple: #b195ef;

Supporting colors
  • --color-solid-purple: #7562af;

  • --color-solid-gray: #7f7f7f;

  • --color-dark-gray: #222222;

Derived colors
Surfaces
  • --color-lightness-surface-highlight: 0.04;

  • --color-lightness-surface-hit: -0.04;


  • --color-magic-purple-surface-highlight: oklch(from var(--color-magic-purple) calc(l + var(--color-lightness-surface-highlight)) c h);

  • --color-magic-purple-surface-hit: oklch(from var(--color-magic-purple) calc(l + var(--color-lightness-surface-hit)) c h);


  • --color-bright-pink-surface-highlight: oklch(from var(--color-bright-pink) calc(l + var(--color-lightness-surface-highlight)) c h);

  • --color-bright-pink-surface-hit: oklch(from var(--color-bright-pink) calc(l + var(--color-lightness-surface-hit)) c h);

Content
  • --color-lightness-content-highlight: 0.1;

  • --color-lightness-content-hit: 0.2;


  • --color-magic-purple-content-highlight: oklch(from var(--color-magic-purple) calc(l + var(--color-lightness-content-highlight)) c h);

  • --color-magic-purple-content-hit: oklch(from var(--color-magic-purple) calc(l + var(--color-lightness-content-hit)) c h);

Color Theme

A color theme assigns the color palette colors to semantic roles. The standard roles of the component system are as follows:

Color theme (light mode)
Areas
  • --theme-color-body: var(--color-white);

  • --theme-color-body-content: var(--color-black);

  • --theme-color-body-content-active: var(--color-magic-purple);

  • --theme-color-body-content-active-highlight: var(--color-magic-purple-content-highlight);

  • --theme-color-body-content-active-hit: var(--color-magic-purple-content-hit);

  • --theme-color-body-content-disabled: var(--color-solid-gray);

  • --theme-color-body-outline: transparent;


  • --theme-color-section: var(--color-deep-blue);

  • --theme-color-section-content: var(--color-white);

  • --theme-color-section-outline: transparent;


  • --theme-color-popover: var(--color-light-gray);

  • --theme-color-popover-content: var(--color-black);

  • --theme-color-popover-outline: var(--color-light-gray);

Elements
Active
  • --theme-color-active: var(--color-magic-purple);

  • --theme-color-active-content: var(--color-white);

  • --theme-color-active-outline: var(--color-magic-purple);


  • --theme-color-active-highlight: var(--color-magic-purple-surface-highlight);

  • --theme-color-active-highlight-content: var(--color-white);

  • --theme-color-active-highlight-outline: var(--color-magic-purple-surface-highlight);


  • --theme-color-active-hit: var(--color-magic-purple-surface-hit);

  • --theme-color-active-hit-content: var(--color-white);

  • --theme-color-active-hit-outline: var(--color-magic-purple-surface-hit);

Danger
  • --theme-color-danger: var(--color-bright-pink);

  • --theme-color-danger-content: var(--color-white);

  • --theme-color-danger-outline: var(--color-bright-pink);


  • --theme-color-danger-highlight: var(--color-bright-pink-surface-highlight);

  • --theme-color-danger-highlight-content: var(--color-white);

  • --theme-color-danger-highlight-outline: var(--color-bright-pink-surface-highlight);


  • --theme-color-danger-hit: var(--color-bright-pink-surface-hit);

  • --theme-color-danger-hit-content: var(--color-white);

  • --theme-color-danger-hit-outline: var(--color-bright-pink-surface-hit);

Neutral
  • --theme-color-neutral: transparent;

  • --theme-color-neutral-content: var(--color-black);

  • --theme-color-neutral-content-hint: var(--color-solid-gray);

  • --theme-color-neutral-outline: var(--color-black);


  • --theme-color-neutral-highlight: transparent;

  • --theme-color-neutral-highlight-content: var(--color-black);

  • --theme-color-neutral-highlight-outline: var(--color-magic-purple-surface-highlight);


  • --theme-color-neutral-hit: transparent;

  • --theme-color-neutral-hit-content: var(--color-black);

  • --theme-color-neutral-hit-outline: var(--color-magic-purple-surface-hit);


  • --theme-color-neutral-disabled: var(--color-light-gray);

  • --theme-color-neutral-disabled-content: var(--color-solid-gray);

  • --theme-color-neutral-disabled-outline: var(--color-solid-gray);


  • --theme-color-neutral-error: transparent;

  • --theme-color-neutral-error-content: var(--color-black);

  • --theme-color-neutral-error-outline: var(--color-bright-pink);


  • --theme-color-neutral-error-highlight: transparent;

  • --theme-color-neutral-error-highlight-content: var(--color-black);

  • --theme-color-neutral-error-highlight-outline: var(--color-bright-pink-surface-highlight);

Color theme (dark mode)
Areas
  • --theme-color-body: var(--color-black);

  • --theme-color-body-content: var(--color-white);

  • --theme-color-body-content-active: var(--color-magic-purple);

  • --theme-color-body-content-active-highlight: var(--color-magic-purple-content-highlight);

  • --theme-color-body-content-active-hit: var(--color-magic-purple-content-hit);

  • --theme-color-body-content-disabled: var(--color-solid-gray);

  • --theme-color-body-outline: transparent;


  • --theme-color-section: var(--color-deep-blue);

  • --theme-color-section-content: var(--color-white);

  • --theme-color-section-outline: transparent;


  • --theme-color-popover: var(--color-dark-gray);

  • --theme-color-popover-content: var(--color-white);

  • --theme-color-popover-outline: var(--color-dark-gray);

Elements
Active
  • --theme-color-active: var(--color-magic-purple);

  • --theme-color-active-content: var(--color-white);

  • --theme-color-active-outline: var(--color-magic-purple);


  • --theme-color-active-highlight: var(--color-magic-purple-surface-highlight);

  • --theme-color-active-highlight-content: var(--color-white);

  • --theme-color-active-highlight-outline: var(--color-magic-purple-surface-highlight);


  • --theme-color-active-hit: var(--color-magic-purple-surface-hit);

  • --theme-color-active-hit-content: var(--color-white);

  • --theme-color-active-hit-outline: var(--color-magic-purple-surface-hit);

Danger
  • --theme-color-danger: var(--color-bright-pink);

  • --theme-color-danger-content: var(--color-white);

  • --theme-color-danger-outline: var(--color-bright-pink);


  • --theme-color-danger-highlight: var(--color-bright-pink-surface-highlight);

  • --theme-color-danger-highlight-content: var(--color-white);

  • --theme-color-danger-highlight-outline: var(--color-bright-pink-surface-highlight);


  • --theme-color-danger-hit: var(--color-bright-pink-surface-hit);

  • --theme-color-danger-hit-content: var(--color-white);

  • --theme-color-danger-hit-outline: var(--color-bright-pink-surface-hit);

Neutral
  • --theme-color-neutral: transparent;

  • --theme-color-neutral-content: var(--color-white);

  • --theme-color-neutral-content-hint: var(--color-solid-gray);

  • --theme-color-neutral-outline: var(--color-white);


  • --theme-color-neutral-highlight: transparent;

  • --theme-color-neutral-highlight-content: var(--color-white);

  • --theme-color-neutral-highlight-outline: var(--color-magic-purple-surface-highlight);


  • --theme-color-neutral-hit: transparent;

  • --theme-color-neutral-hit-content: var(--color-white);

  • --theme-color-neutral-hit-outline: var(--color-magic-purple-surface-hit);


  • --theme-color-neutral-disabled: var(--color-dark-gray);

  • --theme-color-neutral-disabled-content: var(--color-solid-gray);

  • --theme-color-neutral-disabled-outline: var(--color-solid-gray);


  • --theme-color-neutral-error: transparent;

  • --theme-color-neutral-error-content: var(--color-white);

  • --theme-color-neutral-error-outline: var(--color-bright-pink);


  • --theme-color-neutral-error-highlight: transparent;

  • --theme-color-neutral-error-highlight-content: var(--color-white);

  • --theme-color-neutral-error-highlight-outline: var(--color-bright-pink-surface-highlight);

Layout

Consistency in padding and margin values is paramount in good web application design. Appropriate spacing helps the user conceptually separate different areas in a user interface, which in turn makes the user interface easier to use.

Spacing & Splits

The style system comes with the following semantic spacing and splitting elements:

Spacing
  • --length-gap-subelement: 0.3125rem;

  • --length-gap-element: 0.625rem;

  • --length-gap-group: 1.25rem;

  • --length-gap-subsection: 1.875rem;

  • --length-gap-section: 2.5rem;

  • --length-gap-region: 3.75rem;

Splits
  • --split-equal: 1fr 1fr;

  • --split-golden-ratio: 1.618fr 1fr;

  • --split-golden-ratio-reverse: 1fr 1.618fr;

Text Margins

The style system generally aligns the space before and after headings according to the golden ratio, and uses multiples of body leading as the total height to achieve baseline consistency in multi-column text arrangements. For subheadings we switch to using an equal spacing, as the difference between the golden ratio major and minor segments at that scale is too subtle to be interpreted as an intentional design choice.

Heading heights
  • --length-title-height: calc(7 * var(--font-leading-body));

  • --length-subtitle-height: calc(2 * var(--font-leading-body));

  • --length-heading-height: calc(5 * var(--font-leading-body));

  • --length-subheading-height: calc(3 * var(--font-leading-body));

Margin components
  • --golden-ratio-major: 0.618;

  • --golden-ratio-minor: 0.382;

  • --equal-ratio: 0.5;


  • --length-margin-start-title: calc((var(--length-title-height) - var(--font-leading-title)) * var(--golden-ratio-major));

  • --length-margin-end-title: calc((var(--length-title-height) - var(--font-leading-title)) * var(--golden-ratio-minor));

  • --length-margin-start-subtitle: calc((var(--length-subtitle-height) - var(--font-leading-subtitle)) * var(--golden-ratio-major));

  • --length-margin-end-subtitle: calc((var(--length-subtitle-height) - var(--font-leading-subtitle)) * var(--golden-ratio-minor));

  • --length-margin-start-heading: calc((var(--length-heading-height) - var(--font-leading-heading)) * var(--golden-ratio-major));

  • --length-margin-end-heading: calc((var(--length-heading-height) - var(--font-leading-heading)) * var(--golden-ratio-minor));

  • --length-margin-start-subheading: calc((var(--length-subheading-height) - var(--font-leading-subheading)) * var(--equal-ratio));

  • --length-margin-end-subheading: calc((var(--length-subheading-height) - var(--font-leading-subheading)) * var(--equal-ratio));


  • --length-margin-start-paragraph: var(--font-leading-body);

  • --length-margin-end-paragraph: var(--font-leading-body);

  • --length-margin-start-subparagraph: calc(var(--font-leading-body) * 0.5);

  • --length-margin-end-subparagraph: calc(var(--font-leading-body) * 0.5);

Margins
Heading
  • --margin-title: var(--length-margin-start-title) 0 var(--length-margin-end-title);

  • --margin-subtitle: var(--length-margin-start-subtitle) 0 var(--length-margin-end-subtitle);

  • --margin-heading: var(--length-margin-start-heading) 0 var(--length-margin-end-heading);

  • --margin-subheading: var(--length-margin-start-subheading) 0 var(--length-margin-end-subheading);

Paragraph
  • --margin-paragraph: var(--length-margin-start-paragraph) 0 var(--length-margin-end-paragraph);

  • --margin-subparagraph: var(--length-margin-start-subparagraph) 0 var(--length-margin-end-subparagraph);

Elements

The element sizes defined by the style system are as follows:

Elements
Radii
  • --length-radius-element: 0.5rem;

  • --length-radius-group: 1rem;

Edges
  • --length-edge-element: 0.0625rem;

  • --length-edge-group: 0.125rem;

Areas
  • --length-element-width: 18.75rem;

  • --length-form-width: 24rem;

  • --length-card-width: 27rem;


  • --length-button-icon: 1.5rem;

  • --length-nav-logo-height: 1.25rem;

Text
  • --length-text-width: 50rem;

  • --length-text-width-code: 75rem;

  • --length-text-indent: 2em;