Coverage for an_website/utils/themes.py: 100.000%

7 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-11-16 19:56 +0000

1# This program is free software: you can redistribute it and/or modify 

2# it under the terms of the GNU Affero General Public License as 

3# published by the Free Software Foundation, either version 3 of the 

4# License, or (at your option) any later version. 

5# 

6# This program is distributed in the hope that it will be useful, 

7# but WITHOUT ANY WARRANTY; without even the implied warranty of 

8# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

9# GNU Affero General Public License for more details. 

10# 

11# You should have received a copy of the GNU Affero General Public License 

12# along with this program. If not, see <https://www.gnu.org/licenses/>. 

13 

14"""A module providing THEMES.""" 

15 

16from __future__ import annotations 

17 

18from typing import Final 

19 

20from .. import STATIC_DIR 

21 

22 

23def get_themes() -> tuple[str, ...]: 

24 """Get a list of available themes.""" 

25 files = (STATIC_DIR / "css/themes").iterdir() 

26 return ( 

27 *(file.name[:-4] for file in files if file.name.endswith(".css")), 

28 "random", # add random to the list of themes 

29 "random_dark", 

30 ) 

31 

32 

33THEMES: Final[tuple[str, ...]] = get_themes()