aqt.theme#

Attributes#

Classes#

ColoredIcon

WidgetStyle

Enum where members are also (and must be) ints

Theme

Enum where members are also (and must be) ints

ThemeManager

Functions#

get_windows_dark_mode(→ bool)

True if Windows system is currently in dark mode.

set_macos_dark_mode(→ bool)

True if setting successful.

get_macos_dark_mode(→ bool)

True if macOS system is currently in dark mode.

get_linux_dark_mode(→ bool)

True if Linux system is in dark mode.

Module Contents#

class aqt.theme.ColoredIcon#
path: str#
color: dict[str, str]#
current_color(night_mode: bool) str#
with_color(color: dict[str, str]) ColoredIcon#
class aqt.theme.WidgetStyle#

Bases: enum.IntEnum

Enum where members are also (and must be) ints

ANKI = 0#
NATIVE = 1#
class aqt.theme.Theme#

Bases: enum.IntEnum

Enum where members are also (and must be) ints

FOLLOW_SYSTEM = 0#
LIGHT = 1#
DARK = 2#
class aqt.theme.ThemeManager#
rtl() bool#
left() str#
right() str#
DARK_MODE_BUTTON_BG_MIDPOINT = '#555555'#
macos_dark_mode() bool#

True if the user has night mode on.

get_night_mode() bool#
set_night_mode(val: bool) None#
night_mode#
themed_icon(path: str) str#

Fetch themed version of svg.

icon_from_resources(path: str | ColoredIcon) aqt.qt.QIcon#

Fetch icon from Qt resources.

body_class(night_mode: bool | None = None, reviewer: bool = False) str#

Returns space-separated class list for platform/theme/global settings.

body_classes_for_card_ord(card_ord: int, night_mode: bool | None = None) str#

Returns body classes used when showing a card.

var(vars: dict[str, str]) str#

Given day/night colors/props, return the correct one for the current theme.

qcolor(colors: dict[str, str]) aqt.qt.QColor#

Create QColor instance from CSS string for the current theme.

apply_style() None#

Apply currently configured style.

aqt.theme.get_windows_dark_mode() bool#

True if Windows system is currently in dark mode.

aqt.theme.set_macos_dark_mode(enabled: bool) bool#

True if setting successful.

aqt.theme.get_macos_dark_mode() bool#

True if macOS system is currently in dark mode.

aqt.theme.get_linux_dark_mode() bool#

True if Linux system is in dark mode. Only works if D-Bus is installed and system uses org.freedesktop.appearance color-scheme to indicate dark mode preference OR if GNOME theme has ‘-dark’ in the name.

aqt.theme.theme_manager#