-
-
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
Improve theme display #30671
base: main
Are you sure you want to change the base?
Improve theme display #30671
Conversation
wxiaoguang
commented
Apr 24, 2024
•
edited
Loading
edited
247084f
to
cbb63bc
Compare
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.
Need to move variable to :root
.
I won't do it, unless you could write clear code to implement it, but I think it is impossible (not feasible in my mind) |
I don't see why a regex like |
Easy match: https://regex101.com/r/nJEo79/3 |
Just do it. |
Working on new regex. |
Ugh thanks for the merge conflict. |
It's the same time as answering #30671 (comment) ... the conflict could be simple because I didn't change much, only removed PreferColorSchemes and added some comments |
New version is up. It parses for the last occurence of a variable in a file. If that does not suit you, we install a full CSS parser. |
Because many frontend compilers remove all the comments. |
I have no real preference between the two proposed solutions. I don't love magical CSS being parsed/scraped for metadata. I don't want to "concern stall" this PR into the ground, though, so if no one else has similar concerns I will leave it at that. |
/* more custom theme variables ... */ | ||
} | ||
``` | ||
|
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.
Needs example how to implement a "auto" theme.
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.
I do not think it needs an example, just copy the "gitea-auto.css"
We can't teach everything here, just like we don't need to explain the --color-xxx
one by one.
If you have ideas about how to implement an "auto" theme, feel free to edit the documents.
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.
Update the document fdfd440
I still want it in footer .left-links::after {
content: var(--theme-name);
} As CSS gets more advanced, more such use cases will arise and we are blocking us out of them by making the variables unavailable to CSS. I find it insane that we declare variables that are out of variable scope. It's like a unused variable. |
I have also explained the problem above: it is absolutely an abuse. The "display name" should be prepared by backend code and provided by |
19bacd6
to
fdfd440
Compare
I guess I won't block any more because the changes are needed for later work, but I won't approve it either until it's changed to use |
Another we should just put put it into a "legal comment" block at the start, arguably better then a CSS block that never matches anything. /*!
name: My Theme
url: https://gitea.com/my/theme
*/ Or even simpler: /*! My Theme - https://gitea.com/my/theme */ |
I agree |
By putting a |
Then it sill needs some "tag" to help the locate the comment block. Does this look good to you? Or other ideas?
|
@wxiaoguang I think this proposal looks good, and it would solve the remaining criticism, could you update the PR? |
I'm sorry the documentation changes need to be sent to https://gitea.com/gitea/docs |
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.
I can grumpily approve this as I think it's more important that we do this step then to bikeshed any further. Still I would prefer to see the new property on :root
.