Skip to content

Commit

Permalink
Added Bootswatch Slate theme v5.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
marnvermuldir committed Jun 20, 2024
1 parent 5094546 commit 76c9643
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,22 @@ template loader's dirs if it isn't already present.
### Templates
The `eunicore/templates` directory can be used to override any template file used by the
Alliance Auth application.

### AA v4.x Theme

Add `eunicore.theme.slate` to INSTALLED_APPS.

Add the following to `local.py` as well if you only the Slate theme available.

```python
# Sets default theme to Slate.
DEFAULT_THEME = "eunicore.theme.slate.auth_hooks.SlateThemeHook"

# Legacy AAv3 user.profile.night_mode=1. This is the default set by the EUni Auth Backend.
DEFAULT_THEME_DARK = "eunicore.theme.slate.auth_hooks.SlateThemeHook"

# Remove the default BS5 themes
INSTALLED_APPS.remove("allianceauth.theme.darkly")
INSTALLED_APPS.remove("allianceauth.theme.flatly")
INSTALLED_APPS.remove("allianceauth.theme.materia")
```
Empty file added eunicore/theme/__init__.py
Empty file.
Empty file.
9 changes: 9 additions & 0 deletions eunicore/theme/slate/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Django
from django.apps import AppConfig


class SlateThemeConfig(AppConfig):
name = "eunicore.theme.slate"
label = "slate"
version = "5.3.3"
verbose_name = f"Bootswatch Slate v{version}"
43 changes: 43 additions & 0 deletions eunicore/theme/slate/auth_hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Django
from django.templatetags.static import static

# Alliance Auth
from allianceauth import hooks
from allianceauth.theme.hooks import ThemeHook


class SlateThemeHook(ThemeHook):
"""
Bootswatch Slate Theme
https://bootswatch.com/slate/
"""

def __init__(self):
ThemeHook.__init__(
self,
"Slate",
"Shades of gunmetal gray",
css=[
{
"url": "https://cdnjs.cloudflare.com/ajax/libs/bootswatch/5.3.3/slate/bootstrap.min.css",
"integrity": "sha512-3EVe7TjxthzbTGfmRFr7zIvHjDWW7viFDgKOoTJ7S5IIrrKVN5rbPVjj0F7nT6rTyAkURnzwoujxlALvHoO9jw==",
},
{"url": static("eunicore/theme/slate/css/tweaks.css")},
],
js=[
{
"url": "https://cdnjs.cloudflare.com/ajax/libs/popper.js/2.11.8/umd/popper.min.js",
"integrity": "sha512-TPh2Oxlg1zp+kz3nFA0C5vVC6leG/6mm1z9+mA81MI5eaUVqasPLO8Cuk4gMF4gUfP5etR73rgU/8PNMsSesoQ==",
},
{
"url": "https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.3/js/bootstrap.min.js",
"integrity": "sha512-ykZ1QQr0Jy/4ZkvKuqWn4iF3lqPZyij9iRv6sGqLRdTPkY69YX6+7wvVGmsdBbiIfN/8OdsI7HABjvEok6ZopQ==",
},
],
header_padding="4.5em",
)


@hooks.register("theme_hook")
def register_slate_hook():
return SlateThemeHook()
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* Default body color doesn't contrast enough under .bg-success for the dashboard software version */
#aa-dashboard-panel-software-version .bg-success {
--bs-body-color: #fff;
}

0 comments on commit 76c9643

Please sign in to comment.