coalition.content.theme_service

Theme service for generating dynamic CSS and managing theme-related operations.

Classes

ThemeService

Service for theme-related operations and CSS generation

Module Contents

class coalition.content.theme_service.ThemeService[source]

Service for theme-related operations and CSS generation

static get_theme_css_response(theme: coalition.content.models.Theme | None = None) django.http.HttpResponse[source]

Generate a CSS HttpResponse for a theme.

Parameters:

theme – Theme instance. If None, uses the active theme.

Returns:

HttpResponse with CSS content type

static generate_theme_css(theme: coalition.content.models.Theme) str[source]

Generate complete CSS for a theme including variables and custom CSS.

Parameters:

theme – Theme instance

Returns:

Complete CSS string

static generate_utility_classes() str[source]

Generate utility CSS classes that use theme variables. These provide easy-to-use classes for common theming needs.

static get_theme_for_homepage(homepage: coalition.content.models.HomePage) coalition.content.models.Theme | None[source]

Get the effective theme for a homepage.

Parameters:

homepage – HomePage instance

Returns:

Theme instance or None

static apply_theme_to_component_props(theme: coalition.content.models.Theme | None) dict[source]

Generate props dictionary with theme values for React components.

Parameters:

theme – Theme instance or None

Returns:

Dictionary with theme properties