Skip to content

Commit 0ff67af

Browse files
authored
Add light theme (#29)
1 parent a280648 commit 0ff67af

File tree

10 files changed

+198
-66
lines changed

10 files changed

+198
-66
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ jobs:
1717

1818
needs: build
1919

20-
strategy:
21-
matrix:
22-
node-version: [12.x]
23-
2420
steps:
2521
- uses: actions/checkout@v4
2622

@@ -38,7 +34,7 @@ jobs:
3834
uses: softprops/action-gh-release@v1
3935
if: startsWith(github.ref, 'refs/tags/v')
4036
with:
41-
files: ./artifacts/codam-web-greeter.zip
37+
files: ./artifacts/*.zip
4238
tag_name: ${{ github.ref }}
4339
name: codam-web-greeter ${{ github.ref_name }}
4440
generate_release_notes: true

.github/workflows/webpack.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
strategy:
1919
matrix:
2020
node-version: [12.x]
21+
theme: [dark, light]
22+
boxed: [default, boxed]
2123

2224
steps:
2325
- uses: actions/checkout@v4
@@ -37,7 +39,7 @@ jobs:
3739
3840
- name: Build codam-web-greeter
3941
run: |
40-
make build
42+
make build CLIENT_THEME=${{ matrix.theme }} CLIENT_THEME_BOXED=${{ matrix.boxed }}
4143
4244
- name: Add dist folder to artifact
4345
working-directory: dist
@@ -51,6 +53,6 @@ jobs:
5153
- name: Upload Artifact
5254
uses: actions/upload-artifact@v3
5355
with:
54-
name: codam-web-greeter
56+
name: codam-web-greeter-${{ matrix.theme }}-${{ matrix.boxed }}
5557
path: codam-web-greeter.zip
5658
retention-days: 1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,4 @@ server/messages.json
140140
server/configs/certs/*
141141
server/build/*
142142
static/data.json
143+
static/greeter.css

Makefile

Lines changed: 61 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,90 @@ THEME_DIR := /usr/share/web-greeter/themes
66
# - credit: https://stackoverflow.com/a/23324703/2726733
77
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
88

9+
# Theme of the codam-web-greeter client
10+
# can either be 'light' or 'dark', default is 'dark'
11+
CLIENT_THEME := dark
12+
# Add a background color to the form of the login/unlock screen (for better readability if your wallpaper requires this)
13+
# if set to 'boxed' the form will have a background color
14+
CLIENT_THEME_BOXED :=
15+
16+
# Detect MacOS
17+
ifeq ($(shell uname),Darwin)
18+
SED := sed -i ''
19+
else
20+
SED := sed -i
21+
endif
22+
23+
# CLIENT
924
all: build
1025

1126
npm-install:
1227
npm install
1328

14-
build: npm-install copy-files
29+
build: static/greeter.css npm-install copy-files
1530
npm run build
1631
npm run bundle
1732

1833
copy-files:
19-
mkdir -p $(ROOT_DIR)/dist
20-
cp README.md LICENSE $(ROOT_DIR)/dist
21-
cp -r $(ROOT_DIR)/static/* $(ROOT_DIR)/dist
34+
ifeq ($(CLIENT_THEME), light)
35+
$(MAKE) use-light-theme
36+
else # fallback to dark theme
37+
$(MAKE) use-dark-theme
38+
endif
39+
ifeq ($(CLIENT_THEME_BOXED), boxed)
40+
$(MAKE) use-boxed-theme
41+
else # fallback to no boxed theme
42+
$(MAKE) no-boxed-theme
43+
endif
44+
mkdir -p "$(ROOT_DIR)/dist"
45+
cp README.md LICENSE "$(ROOT_DIR)/dist"
46+
cp -r "$(ROOT_DIR)/static/"* "$(ROOT_DIR)/dist"
2247

2348
install: build
2449
install -dm755 $(THEME_DIR)/$(THEME_NAME)
25-
cp -r $(ROOT_DIR)/dist/* $(THEME_DIR)/$(THEME_NAME)
26-
bash $(ROOT_DIR)/systemd/install.sh
50+
cp -r "$(ROOT_DIR)/dist"/* "$(THEME_DIR)/$(THEME_NAME)"
51+
bash "$(ROOT_DIR)/systemd/install.sh"
2752
@echo "Update your /etc/lightdm/web-greeter.yml config file manually to enable the Codam theme"
2853

2954
uninstall:
30-
rm -r $(THEME_DIR)/$(THEME_NAME)
55+
rm -r "$(THEME_DIR)/$(THEME_NAME)"
3156
[ -f /usr/share/codam/uninstall-codam-web-greeter-service.sh ] && bash /usr/share/codam/uninstall-codam-web-greeter-service.sh
3257
@echo "Update your /etc/lightdm/web-greeter.yml config file manually to disable the Codam theme if needed"
3358

59+
re:
60+
rm -f "$(ROOT_DIR)/static/greeter.css"
61+
rm -rf "$(ROOT_DIR)/build"
62+
rm -rf "$(ROOT_DIR)/dist"
63+
make build
64+
65+
# CLIENT THEMING
66+
static/greeter.css:
67+
echo "@import 'css/styles.css';" > "$(ROOT_DIR)/static/greeter.css"
68+
echo "@import 'css/dark.css';" >> "$(ROOT_DIR)/static/greeter.css"
69+
70+
use-light-theme:
71+
$(SED) 's/dark.css/light.css/' "$(ROOT_DIR)/static/greeter.css"
72+
73+
use-dark-theme:
74+
$(SED) 's/light.css/dark.css/' "$(ROOT_DIR)/static/greeter.css"
75+
76+
use-boxed-theme:
77+
echo "@import 'css/boxed.css';" >> "$(ROOT_DIR)/static/greeter.css"
78+
79+
no-boxed-theme:
80+
$(SED) '/boxed.css/d' "$(ROOT_DIR)/static/greeter.css"
81+
82+
# SERVER
3483
update_server_version:
35-
bash $(ROOT_DIR)/server/match_versions.sh
84+
bash "$(ROOT_DIR)/server/match_versions.sh"
3685

3786
server: update_server_version
38-
[ -f $(ROOT_DIR)/server/messages.json ] || echo "{}" > $(ROOT_DIR)/server/messages.json
87+
[ -f $(ROOT_DIR)/server/messages.json ] || echo '{}' > "$(ROOT_DIR)/server/messages.json"
3988
cd $(ROOT_DIR)/server
40-
docker compose -f $(ROOT_DIR)/server/docker-compose.yaml up -d
89+
docker compose -f "$(ROOT_DIR)/server/docker-compose.yaml" up -d
4190

4291
server-stop:
4392
cd $(ROOT_DIR)/server
44-
docker compose -f $(ROOT_DIR)/server/docker-compose.yaml down
45-
46-
re:
47-
rm -rf $(ROOT_DIR)/build
48-
rm -rf $(ROOT_DIR)/dist
49-
make build
93+
docker compose -f "$(ROOT_DIR)/server/docker-compose.yaml" down
5094

51-
.PHONY: all npm-install build copy-files install uninstall server update_server_version re
95+
.PHONY: all npm-install build copy-files install uninstall re use-light-theme use-boxed-theme server update_server_version server-stop

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,28 @@ sudo systemctl restart lightdm
6666
```
6767

6868

69-
## Troubleshooting
69+
## Development
70+
71+
### Client
72+
Use the provided Makefile to build the theme:
73+
```bash
74+
make
75+
```
76+
77+
You can optionally build the theme in light mode:
78+
```bash
79+
make CLIENT_THEME=light
80+
```
81+
82+
Or in light mode with a boxed form to make the login/unlock form more readable:
83+
```bash
84+
make CLIENT_THEME=light CLIENT_THEME_BOXED=boxed
85+
```
86+
87+
88+
#### Debugging the client
89+
You can then open the *static/index.html* file in your browser to do some basic editing, but for most things you'll want to install the greeter on your system and run it in debug mode.
7090

71-
### How to debug
7291
Add the following line to `/usr/share/xsessions/ubuntu.desktop`:
7392
```conf
7493
X-LightDM-Allow-Greeter=true
@@ -83,6 +102,21 @@ You can then open the Developer Tools sidebar from the greeter's menu and view t
83102

84103
Do not forget to remove the line from `/usr/share/xsessions/ubuntu.desktop` after you're done debugging - it's a security risk to allow the greeter to be run by regular users.
85104

105+
106+
### Server
107+
Use the provided Makefile to build the server or use the docker-compose file in the *server/* directory directly:
108+
```bash
109+
# Makefile method
110+
make server
111+
112+
# Docker-compose method
113+
cd server
114+
docker compose up
115+
```
116+
117+
118+
## Troubleshooting
119+
86120
### Locking the screen doesn't work at all
87121
Make sure the LightDM config allows user-switching. Add the following line to */etc/lightdm/lightdm.conf*:
88122
```conf

static/css/boxed.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
form {
2+
background-color: var(--bg-color-darken-strong) !important;
3+
border-radius: var(--border-radius) !important;
4+
}

static/css/dark.css

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
:root {
2+
/* Codam colors (do not change) */
3+
--color-yellow: #F2911A;
4+
--color-orange: #EA5C28;
5+
--color-red: #E52A2D;
6+
--color-purple: #B73188;
7+
--color-blue: #3AA2DB;
8+
--color-black: #000000;
9+
--color-white: #FFFFFF;
10+
11+
/* Theme colors */
12+
--color-primary: var(--color-blue);
13+
14+
/* Text colors */
15+
--color-text-primary: #EDEDED;
16+
--color-text-secondary: #A6A6A6;
17+
--color-text-tertiary: #6E6E6E;
18+
--color-text-error: var(--color-red);
19+
--color-text-success: var(--color-blue);
20+
--color-text-warning: var(--color-yellow);
21+
22+
/* Backgrounds */
23+
--color-bg: var(--color-black);
24+
--bg-color-darken: rgba(0, 0, 0, 0.2);
25+
--bg-color-darken-strong: rgba(0, 0, 0, 0.65);
26+
--bg-color-lighten: rgba(255, 255, 255, 0.2);
27+
--bg-color-disabled-button: rgba(16, 16, 16, 0.3);
28+
--text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
29+
30+
/* Events */
31+
--event-color-default: #00BABC;
32+
--event-color-exam: #ED8179;
33+
--event-color-association: #7E93D4;
34+
--event-color-standup: #8E9C9C; /* Bocal Stand-up */
35+
--event-color-workshop: #39D88F;
36+
--event-color-rush: #F2911A;
37+
--event-color: var(--event-color-default); /* fallback */
38+
}

static/css/light.css

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
:root {
2+
/* Codam colors (do not change) */
3+
--color-yellow: #F2911A;
4+
--color-orange: #EA5C28;
5+
--color-red: #E52A2D;
6+
--color-purple: #B73188;
7+
--color-blue: #3AA2DB;
8+
--color-black: #000000;
9+
--color-white: #FFFFFF;
10+
11+
/* Theme colors */
12+
--color-primary: var(--color-blue);
13+
14+
/* Text colors */
15+
--color-text-primary: #121212;
16+
--color-text-secondary: #595959;
17+
--color-text-tertiary: #919191;
18+
--color-text-error: var(--color-red);
19+
--color-text-success: var(--color-blue);
20+
--color-text-warning: var(--color-yellow);
21+
22+
/* Backgrounds */
23+
--color-bg: var(--color-white);
24+
--bg-color-darken: rgba(255, 255, 255, 0.2);
25+
--bg-color-darken-strong: rgba(255, 255, 255, 0.65);
26+
--bg-color-lighten: rgba(0, 0, 0, 0.2);
27+
--bg-color-disabled-button: rgba(16, 16, 16, 0.2);
28+
--text-shadow: 0 0 5px rgba(255, 255, 255, 0.33);
29+
30+
/* Events */
31+
--event-color-default: #00BABC;
32+
--event-color-exam: #ED8179;
33+
--event-color-association: #7E93D4;
34+
--event-color-standup: #8E9C9C; /* Bocal Stand-up */
35+
--event-color-workshop: #39D88F;
36+
--event-color-rush: #F2911A;
37+
--event-color: var(--event-color-default); /* fallback */
38+
}
Lines changed: 10 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,10 @@
11
:root {
2-
/* Codam colors (do not change) */
3-
--color-yellow: #F2911A;
4-
--color-orange: #EA5C28;
5-
--color-red: #E52A2D;
6-
--color-purple: #B73188;
7-
--color-blue: #3AA2DB;
8-
--color-black: #000000;
9-
10-
/* Theme colors */
11-
--color-primary: var(--color-blue);
12-
13-
/* Text colors */
14-
--color-text-primary: #EDEDED;
15-
--color-text-secondary: #A6A6A6;
16-
--color-text-tertiary: #6E6E6E;
17-
--color-text-error: var(--color-red);
18-
--color-text-success: var(--color-blue);
19-
--color-text-warning: var(--color-yellow);
20-
21-
/* Backgrounds */
22-
--color-bg: var(--color-black);
23-
--default-bg-img: url('assets/default-wallpaper.png');
24-
--bg-color-darken: rgba(0, 0, 0, 0.2);
25-
--bg-color-darken-strong: rgba(0, 0, 0, 0.65);
2+
/* Colors can be found in css/dark.css and css/light.css */
3+
4+
/* Generic settings */
5+
--default-bg-img: url('../assets/default-wallpaper.png');
266
--blur-bg-filter: blur(5px);
277
--blur-bg-filter-lock-screen: blur(25px);
28-
--bg-color-lighten: rgba(255, 255, 255, 0.2);
29-
--text-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
30-
31-
/* Events */
32-
--event-color-default: #00BABC;
33-
--event-color-exam: #ED8179;
34-
--event-color-association: #7E93D4;
35-
--event-color-standup: #8E9C9C; /* Bocal Stand-up */
36-
--event-color-workshop: #39D88F;
37-
--event-color-rush: #F2911A;
38-
--event-color: var(--event-color-default); /* fallback */
39-
40-
/* Others */
418
--border-radius: 4px;
429
--padding: 8px;
4310
--header-footer-height: 31px;
@@ -306,17 +273,21 @@ form button:not(:disabled):focus {
306273

307274
form button:disabled {
308275
cursor: default;
309-
color: rgba(16, 16, 16, 0.3);
276+
color: var(--bg-color-disabled-button);
310277
text-shadow: none;
311278
}
312279

313280
form button:not(:disabled):active {
314281
transform: scale(0.95);
315282
}
316283

284+
form#lock-form {
285+
margin-top: -50%;
286+
}
287+
317288
#active-user-session-avatar {
318289
display: block;
319-
margin: -50% auto calc(var(--padding) * 6) auto;
290+
margin: 0 auto calc(var(--padding) * 6) auto;
320291
width: 100%;
321292
aspect-ratio: 1 / 1;
322293
object-fit: cover;

static/index.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5-
<link rel="stylesheet" href="styles.css" />
5+
<!-- optional: you can use the following setup to load required css without building greeter.css -->
6+
<!-- <link rel="stylesheet" href="css/dark.css" /> -->
7+
<!-- <link rel="stylesheet" href="css/styles.css" /> -->
8+
<!-- <link rel="stylesheet" href="css/boxed.css" /> -->
9+
<link rel="stylesheet" href="greeter.css" onerror="console.error('Styles are missing: did you use the Makefile to build static/greeter.css?');" />
610
<title>Codam Theme for nody-greeter</title>
711
</head>
812
<body>

0 commit comments

Comments
 (0)