-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add automatic theme discovery #11939
Conversation
Would that make it impossible to remove Gitea's original themes? Could be a big deal for customized instances. |
Yes, shipped themes would be always included. While we could have an option to exclude them, I think it's not a big deal if they are there. |
There are many instances running around that customize their theme; in fact based on my short experience from people asking for help on Discord, it happens more often than not. Usually their point is to add custom company branding/colors/etc, but there are also projects like https://codeberg.org/ which would have to either stop using bindata or patch against our codebase. |
Customize via custom CSS or add entirely new themes? I think it's more of the former, not the latter. Could have a DISABLE_THEMES setting (default empty) if really needed, but I doubt it will be of much use. |
Codeberg does not add its own theme file (e.g. |
They might want to cruely limit users to a single, customized theme thought. I'm thinking maybe retain |
Introduce a new special value '*' for ui.THEMES which will automatically discover installed themes in bindata, custom folder and regular files. Ref: go-gitea#11118
Reworked this so it now only introduces theme discovery via |
|
||
// Init initializes theme-related variables | ||
func Init() { | ||
if reflect.DeepEqual(setting.UI.Themes, []string{"*"}) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is the best way to compare two slices 😉
|
||
func TestThemes(t *testing.T) { | ||
Init() | ||
assert.Contains(t, Themes, "gitea") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would like to do a full test here but I have no idea how to properly initialize the setting
module for the test. If I used models.PrepareTestEnv(t)
it just segfaults during the test.
Will update to not depend on |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions. |
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions. |
Would still like to do this, but this is too outdated now and I guess I would do it once I decide to make a new dark theme :) |
automatic theme discovery -> Initial support for colorblind-friendly themes #30625 |
Introduce a new special value
*
forui.THEMES
which will automatically discover installed themes in bindata, custom folder and regular files.Ref: #11118