# everesh/wanikani-elementarydark architecture

> Architecture diagram of the GitHub repository everesh/wanikani-elementarydark, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/everesh/wanikani-elementarydark
- Repository: https://github.com/everesh/wanikani-elementarydark

## Overview

##### Project type and purpose
- This is a SASS‐based theming project for the WaniKani website called “WaniKani-ElementaryDark.”
- It provides a drop-in dark theme by overriding native CSS variables and injecting compiled CSS into the site.

##### File structure
- Top-level files:
- make.sh – build script
- main.scss – master SASS entry point
- version – version stamp
- Directories:
- base/ – core SASS partials (variables, core styles, legacy fallbacks, overrides)
- pages/ – per-page style overrides
- themes/ – sample CSS theme variants (catppuccin, gruvbox, template)

##### Key README insights
- Maintainability and backwards compatibility by hijacking native CSS variables.
- Entirely rewritten in SASS for modularity.

a. SASS Modules
- base/variables.scss
- base/core.scss
- base/legacy.scss
- base/overrides.scss
- pages/*.scss
- themes/*.css (alternative manifests)
b. Build Process
- make.sh invokes SASS compiler on main.scss
- Outputs final CSS (e.g., dist/wanikani-elementarydark.css)
c. Integration Points
- Host website (WaniKani) supplying native CSS variables
- User’s browser or userscript loading the compiled CSS

##### Relationships & interactions
- main.scss imports base/variables → base/core → base/legacy → base/overrides → pages/*.scss
- make.sh drives SASS compilation, reads main.scss, produces a single CSS file
- Final CSS is injected into WaniKani website, overriding its native variables and selectors

##### Architectural patterns & principles
- Modular SASS partials (separation of concerns)
- Variable hijacking for backwards-compatibility
- Theme layering: core → overrides → page-specific → theme variants

##### Technologies & tools
- SASS/SCSS compiler
- POSIX shell (make.sh)
- WaniKani site CSS variables (external dependency)
- Git for versioning

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Base Modules"
        var["variables.scss"]:::source
        core["core.scss"]:::source
        legacy["legacy.scss"]:::source
        overrides["overrides.scss"]:::source
    end
    subgraph "Page Modules"
        pages["pages/*.scss"]:::source
    end
    subgraph "Theme Variants"
        themes["themes/*.css"]:::source
    end
    var -->|import| main["main.scss"]:::source
    core -->|import| main
    legacy -->|import| main
    overrides -->|import| main
    pages -->|import| main
    themes -->|import/optional| main
    subgraph "Documentation"
        doc["README.md"]:::source
        ver["version"]:::source
    end
    main -->|compile request| make["make.sh / SASS compile"]:::build
    make -->|compile| css["dist/wanikani-elementarydark.css"]:::output
    css -->|inject override| site["WaniKani Site"]:::external

    click var "https://github.com/everesh/wanikani-elementarydark/blob/main/base/variables.scss"
    click core "https://github.com/everesh/wanikani-elementarydark/blob/main/base/core.scss"
    click legacy "https://github.com/everesh/wanikani-elementarydark/blob/main/base/legacy.scss"
    click overrides "https://github.com/everesh/wanikani-elementarydark/blob/main/base/overrides.scss"
    click pages "https://github.com/everesh/wanikani-elementarydark/tree/main/pages/"
    click themes "https://github.com/everesh/wanikani-elementarydark/tree/main/themes/"
    click main "https://github.com/everesh/wanikani-elementarydark/blob/main/main.scss"
    click make "https://github.com/everesh/wanikani-elementarydark/blob/main/make.sh"
    click doc "https://github.com/everesh/wanikani-elementarydark/blob/main/README.md"
    click ver "https://github.com/everesh/wanikani-elementarydark/tree/main/version"

    classDef source fill:#8ecae6,stroke:#333,stroke-width:1px
    classDef build fill:#a7c957,stroke:#333,stroke-width:1px
    classDef output fill:#ffb703,stroke:#333,stroke-width:1px
    classDef external fill:#adb5bd,stroke:#333,stroke-width:1px
```
