Skip to content

Commit c698a6f

Browse files
GiteaBotbrechtvllunnyjolheiser
authored
Scoped label display and documentation tweaks (#23430) (#23433)
Backport #23430 by @brechtvl * Fix scoped label left and right part breaking across lines. * Remove slanted divider in scoped label display, make it straight. After using this for a while, this feels more visually noisy than helpful. * Reduce contrast between scope and item to reduce probability of unreadable text on background. * Change documentation to remove mention of non-exclusive scoped labels. Co-authored-by: Brecht Van Lommel <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: John Olheiser <[email protected]>
1 parent e5a51ec commit c698a6f

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed

docs/content/doc/usage/labels.en-us.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,15 @@ For repositories, labels can be created by going to `Issues` and clicking on `La
2323

2424
For organizations, you can define organization-wide labels that are shared with all organization repositories, including both already-existing repositories as well as newly created ones. Organization-wide labels can be created in the organization `Settings`.
2525

26-
Labels have a mandatory name, a mandatory color, an optional description, and must either be exclusive or not (see `Scoped labels` below).
26+
Labels have a mandatory name, a mandatory color, an optional description, and must either be exclusive or not (see `Scoped Labels` below).
2727

2828
When you create a repository, you can ensure certain labels exist by using the `Issue Labels` option. This option lists a number of available label sets that are [configured globally on your instance](../customizing-gitea/#labels). Its contained labels will all be created as well while creating the repository.
2929

3030
## Scoped Labels
3131

32-
A scoped label is a label that contains `/` in its name (not at either end of the name). For example labels `kind/bug` and `kind/enhancement` both have scope `kind`. Such labels will display the scope with slightly darker color.
32+
Scoped labels are used to ensure at most a single label with the same scope is assigned to an issue or pull request. For example, if labels `kind/bug` and `kind/enhancement` have the Exclusive option set, an issue can only be classified as a bug or an enhancement.
3333

34-
The scope of a label is determined based on the **last** `/`, so for example the scope of label `scope/subscope/item` is `scope/subscope`.
35-
36-
Scoped labels can be marked as exclusive. This ensures at most a single label with the same scope is assigned to an issue or pull request. For example, if `kind/bug` and `kind/enhancement` are marked exclusive, an issue can only be classified as a bug or an enhancement.
34+
A scoped label must contain `/` in its name (not at either end of the name). The scope of a label is determined based on the **last** `/`, so for example the scope of label `scope/subscope/item` is `scope/subscope`.
3735

3836
## Filtering by Label
3937

modules/templates/helper.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ func RenderLabel(ctx context.Context, label *issues_model.Label) string {
834834
// Make scope and item background colors slightly darker and lighter respectively.
835835
// More contrast needed with higher luminance, empirically tweaked.
836836
luminance := (0.299*r + 0.587*g + 0.114*b) / 255
837-
contrast := 0.01 + luminance*0.06
837+
contrast := 0.01 + luminance*0.03
838838
// Ensure we add the same amount of contrast also near 0 and 1.
839839
darken := contrast + math.Max(luminance+contrast-1.0, 0.0)
840840
lighten := contrast + math.Max(contrast-luminance, 0.0)
@@ -859,12 +859,10 @@ func RenderLabel(ctx context.Context, label *issues_model.Label) string {
859859

860860
return fmt.Sprintf("<span class='ui label scope-parent' title='%s'>"+
861861
"<div class='ui label scope-left' style='color: %s !important; background-color: %s !important'>%s</div>"+
862-
"<div class='ui label scope-middle' style='background: linear-gradient(-80deg, %s 48%%, %s 52%% 0%%);'>&nbsp;</div>"+
863862
"<div class='ui label scope-right' style='color: %s !important; background-color: %s !important''>%s</div>"+
864863
"</span>",
865864
description,
866865
textColor, scopeColor, scopeText,
867-
itemColor, scopeColor,
868866
textColor, itemColor, itemText)
869867
}
870868

web_src/less/_repository.less

+2-13
Original file line numberDiff line numberDiff line change
@@ -2831,11 +2831,11 @@
28312831

28322832
.labels-list .label {
28332833
margin: 2px 0;
2834-
display: inline-block !important;
2834+
display: inline-flex !important;
28352835
line-height: 1.3em; // there is a `font-size: 1.25em` for inside emoji, so here the line-height needs to be larger slightly
28362836
}
28372837

2838-
// Scoped labels with different colors on left and right, and slanted divider in the middle
2838+
// Scoped labels with different colors on left and right
28392839
.scope-parent {
28402840
background: none !important;
28412841
padding: 0 !important;
@@ -2844,23 +2844,12 @@
28442844
.ui.label.scope-left {
28452845
border-bottom-right-radius: 0;
28462846
border-top-right-radius: 0;
2847-
padding-right: 0;
2848-
margin-right: 0;
2849-
}
2850-
2851-
.ui.label.scope-middle {
2852-
width: 12px;
2853-
border-radius: 0;
2854-
padding-left: 0;
2855-
padding-right: 0;
2856-
margin-left: 0;
28572847
margin-right: 0;
28582848
}
28592849

28602850
.ui.label.scope-right {
28612851
border-bottom-left-radius: 0;
28622852
border-top-left-radius: 0;
2863-
padding-left: 0;
28642853
margin-left: 0;
28652854
}
28662855

0 commit comments

Comments
 (0)