# jagadeesandev/portal-theme architecture

> Architecture diagram of the GitHub repository jagadeesandev/portal-theme, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jagadeesandev/portal-theme
- Repository: https://github.com/jagadeesandev/portal-theme

## Overview

Portal Theme is a Frappe app for configuring portal-wide colors and a customized login-page appearance. Administrators edit the Portal Theme Setting; the desk script reloads after saves, while the desk-wide script fetches enabled settings and applies CSS variables and rules. The login controller separately reads login-specific settings to populate the page context, including optional background-slider data. The README gives only a high-level theme description; settings fields and runtime behavior are clearer in the sampled source. The setting controller and DocType definitions were not sampled, so persistence details and the precise rendering link are not asserted.

Main entry points: [`portal_theme/www/login.py`](https://github.com/jagadeesandev/portal-theme/blob/main/portal_theme/www/login.py) (Login context and auth), [`portal_theme/portal_theme/doctype/portal_theme_setting`](https://github.com/jagadeesandev/portal-theme/tree/main/portal_theme/portal_theme/doctype/portal_theme_setting) (Theme settings), [`portal_theme/portal_theme/doctype/portal_theme_setting/portal_theme_setting.js`](https://github.com/jagadeesandev/portal-theme/blob/main/portal_theme/portal_theme/doctype/portal_theme_setting/portal_theme_setting.js) (Settings form), [`portal_theme/public/js/portal_theme.js`](https://github.com/jagadeesandev/portal-theme/blob/main/portal_theme/public/js/portal_theme.js) (Desk theme script)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_configuration["Theme configuration"]
  node_settings_form["Settings form"]
  node_theme_settings[("Theme settings")]
  node_background_images[("Background image records")]
end

subgraph group_application["Theme application"]
  node_desk_hook["Desk asset hook<br/>[hooks.py]"]
  node_desk_theme["Desk theme script<br/>[portal_theme.js]"]
end

subgraph group_login["Login experience"]
  node_login_controller["Login context and auth<br/>[login.py]"]
  node_login_template["Login page<br/>[login.html]"]
  node_oauth_providers{{"Social login providers"}}
  node_ldap{{"LDAP settings"}}
end

node_admin(("Administrator"))
node_frappe_settings_api{{"Frappe settings API"}}
node_portal_user(("Portal visitor"))

node_admin -->|"edits"| node_settings_form
node_settings_form -.->|"updates"| node_theme_settings
node_desk_hook -->|"includes script"| node_desk_theme
node_desk_theme -->|"fetches settings"| node_frappe_settings_api
node_frappe_settings_api -.->|"reads"| node_theme_settings
node_portal_user -.->|"requests login"| node_login_controller
node_login_controller -->|"reads login options"| node_theme_settings
node_login_controller -->|"loads providers"| node_oauth_providers
node_login_controller -->|"loads LDAP config"| node_ldap
node_login_controller -.->|"supplies context"| node_login_template

click node_settings_form "https://github.com/jagadeesandev/portal-theme/blob/main/portal_theme/portal_theme/doctype/portal_theme_setting/portal_theme_setting.js"
click node_theme_settings "https://github.com/jagadeesandev/portal-theme/tree/main/portal_theme/portal_theme/doctype/portal_theme_setting"
click node_background_images "https://github.com/jagadeesandev/portal-theme/blob/main/portal_theme/portal_theme/doctype/background_images/background_images.py"
click node_desk_hook "https://github.com/jagadeesandev/portal-theme/blob/main/portal_theme/hooks.py"
click node_desk_theme "https://github.com/jagadeesandev/portal-theme/blob/main/portal_theme/public/js/portal_theme.js"
click node_login_controller "https://github.com/jagadeesandev/portal-theme/blob/main/portal_theme/www/login.py"
click node_login_template "https://github.com/jagadeesandev/portal-theme/blob/main/portal_theme/www/login.html"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_settings_form,node_theme_settings,node_background_images toneBlue
class node_desk_hook,node_desk_theme toneAmber
class node_login_controller,node_login_template,node_oauth_providers,node_ldap,node_frappe_settings_api toneMint
class node_admin,node_portal_user toneIndigo
```

## Components

### Theme configuration

- [Settings form](https://github.com/jagadeesandev/portal-theme/blob/main/portal_theme/portal_theme/doctype/portal_theme_setting/portal_theme_setting.js): `portal_theme/portal_theme/doctype/portal_theme_setting/portal_theme_setting.js`
- [Theme settings](https://github.com/jagadeesandev/portal-theme/tree/main/portal_theme/portal_theme/doctype/portal_theme_setting): `portal_theme/portal_theme/doctype/portal_theme_setting`
- [Background image records](https://github.com/jagadeesandev/portal-theme/blob/main/portal_theme/portal_theme/doctype/background_images/background_images.py): `portal_theme/portal_theme/doctype/background_images/background_images.py`

### Theme application

- [Desk asset hook](https://github.com/jagadeesandev/portal-theme/blob/main/portal_theme/hooks.py): `portal_theme/hooks.py`
- [Desk theme script](https://github.com/jagadeesandev/portal-theme/blob/main/portal_theme/public/js/portal_theme.js): `portal_theme/public/js/portal_theme.js`

### Login experience

- [Login context and auth](https://github.com/jagadeesandev/portal-theme/blob/main/portal_theme/www/login.py): `portal_theme/www/login.py`
- [Login page](https://github.com/jagadeesandev/portal-theme/blob/main/portal_theme/www/login.html): `portal_theme/www/login.html`
- **Social login providers**
- **LDAP settings**

### Other components

- **Administrator**
- **Frappe settings API**
- **Portal visitor**

## Connections

- Administrator → Settings form: edits (evidence: `portal_theme/portal_theme/doctype/portal_theme_setting/portal_theme_setting.js`)
- Settings form → Theme settings: updates
- Desk asset hook → Desk theme script: includes script (evidence: `portal_theme/hooks.py`)
- Desk theme script → Frappe settings API: fetches settings (evidence: `portal_theme/public/js/portal_theme.js`)
- Frappe settings API → Theme settings: reads
- Portal visitor → Login context and auth: requests login
- Login context and auth → Theme settings: reads login options (evidence: `portal_theme/www/login.py`)
- Login context and auth → Social login providers: loads providers (evidence: `portal_theme/www/login.py`)
- Login context and auth → LDAP settings: loads LDAP config (evidence: `portal_theme/www/login.py`)
- Login context and auth → Login page: supplies context
