Available Themes in Alxarafe
Overview
Alxarafe includes a theme system that allows for full visual customization of the application. Themes are selected using the palette switcher (🎨 icon) in the user menu.
Design Philosophy
Most themes are a simple CSS change or a component with different behavior (for example, changing a checkbox for a yes/no selector). The framework is simple by default, but very flexible.
To demonstrate this structural flexibility, Cyberpunk acts as the "black sheep": it relocates the user menu to the right margin (instead of the top), uses larger icons, and has a completely custom layout. All this is achieved through custom components and a layout override, without modifying the base framework.
Principle: The sidebar menu is shown when menu options are available and hidden when they are not. No distinction is made between public and private at the layout level.
Loading Mechanism
The active theme is determined with the following priority:
alx_themecookie → set when changing the theme from the switcher.- User preference →
themefield in the user record (if logged in). - Configuration →
config.json→main.theme. - Fallback →
default.
When a logged-in user changes the theme, it is automatically persisted in their user record.
The theme's CSS is loaded from /themes/{name}/css/default.css and Blade templates are resolved by cascade: first the theme's, then the module's, then the general ones.
Included Themes
1. Default (System)
- Style: Modern, clean, minimalist.
- Palette: Light gray background (#f8f9fa), dark text, blue Bootstrap accents.
- Typography: System UI / Apple sans-serif.
- Scope: CSS only.
2. Alternative
- Style: Pastel, soft, friendly.
- Palette: Cream background (#FDFBF7), periwinkle blue, pale mint, pastel pink.
- Typography: Segoe UI / Tahoma.
- Scope: CSS + components (
boolean,select,fields/).
3. Cyberpunk ⚡ (Structural flexibility demo)
- Style: 80s retrofuturistic, neon, dark.
- Palette: Black background (#0b0c10), neon cyan (#66fcf1), teal (#45a29e).
- Typography: Courier New (monospace).
- Scope: Full custom layout + extensive CSS + components (
card,menu_item,select) + partials (main_menu,user_menu) + source SCSS. - Structural differences: User menu on the right margin (not top), large icons, background grid overlay, glitch/scanline effects.
4. High-Contrast
- Style: Accessibility, high contrast.
- Palette: Black background (#000000), yellow text (#FFFF00), white borders, magenta highlight.
- Typography: Arial / Helvetica (110% base size).
- Scope: CSS + custom card component.
5. Vintage
- Style: Retro, classic, nostalgic.
- Palette: Parchment background (#f4ecd8), brown text (#4e342e), coffee accents (#8d6e63).
- Typography: Georgia / Times New Roman (serif).
- Scope: CSS only.
How to Create a New Theme
- Create a
templates/themes/{my-theme}/folder. - Create
css/default.csswith the theme styles. - (Optional) Override Blade components (e.g.,
component/card.blade.php,form/boolean.blade.php). - (Optional) For structural changes, override the full layout (
partial/layout/main.blade.php). - Run
composer updateto publish assets topublic/themes/.
File Structure per Theme
| Theme | CSS | Custom Layout | Components | Partials |
|---|---|---|---|---|
| default | ✅ | — | — | — |
| alternative | ✅ | — | boolean, select, fields/ | — |
| cyberpunk | ✅ + SCSS | ✅ complete | card, menu_item, select | main_menu, user_menu |
| high-contrast | ✅ | — | card | — |
| vintage | ✅ | — | — | — |
Effective theme and rendering isolation
PreferenceResolver::theme(Auth::$user) is the authority for the effective theme: valid alx_theme cookie, authenticated user preference, application configuration, then default. Identifiers must match an available application or framework theme; invalid values (including traversal strings) are ignored. An error-controller request overrides the effective theme to default for every consumer, including CSS, partials, anonymous components and the theme selector.
Template precedence remains application theme, framework theme, application module, framework module, application templates, framework templates. Each Template owns its Blade container and view finder. Component rendering inherits the active template context. Compiled files live under APP_PATH/var/cache/blade/{theme}/{search-context-hash}: the hash includes ordered search paths because compiled anonymous components embed their selected override. Containers and static component lookup caches are scoped during rendering; disk caching remains enabled, including across independent requests.