Raxol.Core.Accessibility.ThemeIntegration (Raxol v0.2.0)
View SourceManages the integration between accessibility settings and the active theme.
Listens for accessibility changes (e.g., high contrast toggle) and updates the active theme variant accordingly.
Summary
Functions
Apply the current accessibility settings to components. This function is typically called during initialization to ensure components reflect the persisted preferences.
Clean up the theme integration.
Returns the currently active theme variant based on accessibility settings.
Defaults to :default
if high contrast is off.
Handle high contrast mode changes. Stores the active variant (:high_contrast or nil) in the process dictionary. Components should then use a central function (e.g., ColorSystem.get) to query colors.
Handle large text setting changes.
Handle reduced motion setting changes.
Initialize the theme integration.
Functions
Apply the current accessibility settings to components. This function is typically called during initialization to ensure components reflect the persisted preferences.
Clean up the theme integration.
Unregisters event handlers.
Examples
iex> ThemeIntegration.cleanup()
:ok
@spec get_active_variant() :: atom()
Returns the currently active theme variant based on accessibility settings.
Defaults to :default
if high contrast is off.
Handle high contrast mode changes. Stores the active variant (:high_contrast or nil) in the process dictionary. Components should then use a central function (e.g., ColorSystem.get) to query colors.
Handle large text setting changes.
Examples
iex> ThemeIntegration.handle_large_text({:accessibility_large_text, true})
:ok
Handle reduced motion setting changes.
Examples
iex> ThemeIntegration.handle_reduced_motion({:accessibility_reduced_motion, true})
:ok
Initialize the theme integration.
Registers event handlers for accessibility setting changes.
Examples
iex> ThemeIntegration.init()
:ok