Skip to content

Improve theme display #30671

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

Merged
merged 14 commits into from
Mar 8, 2025
Merged

Improve theme display #30671

merged 14 commits into from
Mar 8, 2025

Conversation

wxiaoguang
Copy link
Contributor

@wxiaoguang wxiaoguang commented Apr 24, 2024

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 24, 2024
@wxiaoguang wxiaoguang marked this pull request as draft April 24, 2024 01:44
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Apr 24, 2024
@pull-request-size pull-request-size bot added size/L and removed size/M labels Apr 24, 2024
@github-actions github-actions bot added the modifies/templates This PR modifies the template files label Apr 24, 2024
@wxiaoguang wxiaoguang changed the title WIP: Improve theme Improve theme display Apr 24, 2024
@wxiaoguang wxiaoguang marked this pull request as ready for review April 24, 2024 06:40
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 25, 2024
Copy link
Member

@silverwind silverwind left a 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.

@GiteaBot GiteaBot added lgtm/blocked A maintainer has reservations with the PR and thus it cannot be merged and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 25, 2024
@wxiaoguang
Copy link
Contributor Author

wxiaoguang commented Apr 25, 2024

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)

@silverwind
Copy link
Member

I don't see why a regex like --theme-display-name:\s?(\S+) wouldn't work.

@silverwind
Copy link
Member

silverwind commented Apr 25, 2024

Easy match: https://regex101.com/r/nJEo79/3

@wxiaoguang
Copy link
Contributor Author

I don't see why a regex like --theme-display-name:\s?(\S+) wouldn't work.

Just do it.

@silverwind
Copy link
Member

silverwind commented Apr 25, 2024

Working on new regex.

@silverwind
Copy link
Member

Ugh thanks for the merge conflict.

@wxiaoguang
Copy link
Contributor Author

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

@silverwind
Copy link
Member

silverwind commented Apr 25, 2024

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.

@silverwind
Copy link
Member

silverwind commented May 24, 2024

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 */

@jolheiser
Copy link
Member

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
But #30671 (comment)

@silverwind
Copy link
Member

Why not some form of parse-able frontmatter contained within a defined CSS comment? (Perhaps I missed some prior discussion. Sorry if so.)

Because many frontend compilers remove all the comments.

By putting a ! first character into a comment, it becomes a legal comment which by default many minifiers retain in the output.

@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label May 27, 2024
@wxiaoguang wxiaoguang removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label May 27, 2024
@wxiaoguang wxiaoguang marked this pull request as draft May 27, 2024 10:25
@wxiaoguang
Copy link
Contributor Author

wxiaoguang commented May 27, 2024

Why not some form of parse-able frontmatter contained within a defined CSS comment? (Perhaps I missed some prior discussion. Sorry if so.)

Because many frontend compilers remove all the comments.

By putting a ! first character into a comment, it becomes a legal comment which by default many minifiers retain in the output.

Then it sill needs some "tag" to help the locate the comment block.

Does this look good to you? Or other ideas?

/*!gitea-theme-meta-info
display-name: My Theme
*/

"legal comment" would cause more confusing problems and it seems to be an abuse.

The default behavior is eof when bundling is enabled and inline otherwise. Setting the legal comment mode looks like this:

@denyskon
Copy link
Member

denyskon commented Jul 9, 2024

@wxiaoguang I think this proposal looks good, and it would solve the remaining criticism, could you update the PR?

@lunny
Copy link
Member

lunny commented Jul 10, 2024

I'm sorry the documentation changes need to be sent to https://gitea.com/gitea/docs

Copy link
Member

@silverwind silverwind left a 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.

# Conflicts:
#	docs/content/administration/customizing-gitea.en-us.md
#	routers/web/user/setting/profile.go
@wxiaoguang wxiaoguang marked this pull request as ready for review March 8, 2025 15:28
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 8, 2025
@lunny lunny added this to the 1.24.0 milestone Mar 8, 2025
@lunny lunny enabled auto-merge (squash) March 8, 2025 21:16
@lunny lunny merged commit 6f13331 into go-gitea:main Mar 8, 2025
26 checks passed
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 8, 2025
@wxiaoguang wxiaoguang deleted the theme-meta-info branch March 9, 2025 02:33
zjjhot added a commit to zjjhot/gitea that referenced this pull request Mar 10, 2025
* giteaofficial/main:
  Move notifywatch to service layer (go-gitea#33825)
  [skip ci] Updated translations via Crowdin
  Only keep popular licenses (go-gitea#33832)
  Removing unwanted ui container (go-gitea#33833)
  Full-file syntax highlighting for diff pages (go-gitea#33766)
  Improve theme display (go-gitea#30671)
  Decouple context from repository related structs (go-gitea#33823)
  Improve log format (go-gitea#33814)
  Decouple diff stats query from actual diffing (go-gitea#33810)
  Add global lock for migrations to make upgrade more safe with multiple replications (go-gitea#33706)
  Do not show passkey on http sites (go-gitea#33820)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/frontend modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants