Skip to content
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 the ability to have built in themes in Gitea #4198

Merged
merged 27 commits into from
Jul 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a5e3375
Add the ability to have built in themes in Gitea
techknowlogick Jun 9, 2018
c410f17
Merge branch 'master' into theme
techknowlogick Jun 9, 2018
7686c0c
Merge branch 'master' into theme
techknowlogick Jun 9, 2018
2980555
update per feedback
techknowlogick Jun 11, 2018
b06271d
Merge branch 'master' into theme
techknowlogick Jun 11, 2018
bc898b2
Merge branch 'master' into theme
techknowlogick Jun 12, 2018
5081c40
neq not defined
techknowlogick Jun 12, 2018
fc552b6
Merge branch 'master' into theme
techknowlogick Jun 17, 2018
60757b5
Merge branch 'master' into theme
techknowlogick Jun 19, 2018
c47dc20
Merge branch 'master' into theme
techknowlogick Jun 23, 2018
29fd549
Merge branch 'master' into theme
techknowlogick Jun 24, 2018
6f7d8a1
Merge branch 'master' into theme
techknowlogick Jun 25, 2018
56bae58
Rename theme-dark.css to theme-arc-green.css
techknowlogick Jun 25, 2018
af2665b
Rename dark.less to arc-green.less
techknowlogick Jun 25, 2018
e281c86
strip new line
techknowlogick Jun 25, 2018
37a8076
fix make generate-stylesheets
techknowlogick Jun 25, 2018
366b573
Merge branch 'master' into theme
techknowlogick Jul 3, 2018
8d8c60c
Merge branch 'master' into theme
techknowlogick Jul 4, 2018
554a862
update theme name
techknowlogick Jul 4, 2018
eb5e2ca
update theme name
techknowlogick Jul 4, 2018
3e99050
simplify template
techknowlogick Jul 5, 2018
b70165f
add options for themes
techknowlogick Jul 5, 2018
c3c0c9c
update default theme name
techknowlogick Jul 5, 2018
362a4d0
add documentation about theme
techknowlogick Jul 5, 2018
4ac504f
Merge branch 'master' into theme
techknowlogick Jul 5, 2018
686e0c2
update docs
techknowlogick Jul 5, 2018
d2f944b
Merge branch 'master' into theme
lafriks Jul 5, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ else
endif
endif

# $(call strip-suffix,filename)
strip-suffix = $(firstword $(subst ., ,$(1)))

.PHONY: all
all: build

Expand Down Expand Up @@ -301,7 +304,7 @@ public/js/index.js: $(JAVASCRIPTS)

.PHONY: stylesheets-check
stylesheets-check: generate-stylesheets
@diff=$$(git diff public/css/index.css); \
@diff=$$(git diff public/css/*); \
if [ -n "$$diff" ]; then \
echo "Please run 'make generate-stylesheets' and commit the result:"; \
echo "$${diff}"; \
Expand All @@ -311,6 +314,7 @@ stylesheets-check: generate-stylesheets
.PHONY: generate-stylesheets
generate-stylesheets:
node_modules/.bin/lessc --clean-css public/less/index.less public/css/index.css
$(foreach file, $(filter-out public/less/themes/_base.less, $(wildcard public/less/themes/*)),node_modules/.bin/lessc --clean-css public/less/themes/$(notdir $(file)) > public/css/theme-$(notdir $(call strip-suffix,$(file))).css;)

.PHONY: swagger-ui
swagger-ui:
Expand Down
2 changes: 2 additions & 0 deletions custom/conf/app.ini.sample
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ THEME_COLOR_META_TAG = `#6cc644`
MAX_DISPLAY_FILE_SIZE = 8388608
; Whether the email of the user should be shown in the Explore Users page
SHOW_USER_EMAIL = true
; Set the default theme for the Gitea install
DEFAULT_THEME = gitea
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is better to use the default value ˋdefaultˋ here since you’re using it in the config cheat sheet.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opps. I updated this per @lunny feedback, but I forgot to update docs. Let me do that there.


[ui.admin]
; Number of users that are displayed on one page
Expand Down
1 change: 1 addition & 0 deletions docs/content/doc/advanced/config-cheat-sheet.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
- `EXPLORE_PAGING_NUM`: **20**: Number of repositories that are shown in one explore page.
- `ISSUE_PAGING_NUM`: **10**: Number of issues that are shown in one page (for all pages that list issues).
- `FEED_MAX_COMMIT_NUM`: **5**: Number of maximum commits shown in one activity feed.
- `DEFAULT_THEME`: **gitea**: \[gitea, arc-green\]: Set the default theme for the Gitea install.

### UI - Admin (`ui.admin`)

Expand Down
4 changes: 4 additions & 0 deletions docs/content/doc/advanced/customizing-gitea.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,7 @@ Apart from `extra_links.tmpl` and `extra_tabs.tmpl`, there are other useful temp
## Customizing gitignores, labels, licenses, locales, and readmes.

Place custom files in corresponding sub-folder under `custom/options`.

## Customizing the look of Gitea

Gitea has two built-in themes, the default theme `gitea`, and a dark theme `arc-green`. To change the look of your Gitea install change the value of `DEFAULT_THEME` in the [ui](https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui) section of `app.ini` to another one of the available options.
2 changes: 2 additions & 0 deletions modules/setting/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ var (
ThemeColorMetaTag string
MaxDisplayFileSize int64
ShowUserEmail bool
DefaultTheme string

Admin struct {
UserPagingNum int
Expand All @@ -303,6 +304,7 @@ var (
ReactionMaxUserNum: 10,
ThemeColorMetaTag: `#6cc644`,
MaxDisplayFileSize: 8388608,
DefaultTheme: `gitea`,
Admin: struct {
UserPagingNum int
RepoPagingNum int
Expand Down
3 changes: 3 additions & 0 deletions modules/templates/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ func NewFuncMap() []template.FuncMap {
"ParseDeadline": func(deadline string) []string {
return strings.Split(deadline, "|")
},
"DefaultTheme": func() string {
return setting.UI.DefaultTheme
Copy link
Member

@jonasfranz jonasfranz Jul 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that it may be better to add this as variable to data since this function just acts like a variable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this because this pattern already exists and I am just following. Example see AppUrl above in this file.

},
}}
}

Expand Down
Loading