Skip to content

Commit a8e13e6

Browse files
brechtvllunny
andauthored
Scoped label display and documentation tweaks (#23430)
* 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: Lunny Xiao <[email protected]>
1 parent 43c1362 commit a8e13e6

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed

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

Lines changed: 3 additions & 5 deletions
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

Lines changed: 1 addition & 3 deletions
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

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2838,11 +2838,11 @@
28382838

28392839
.labels-list .label {
28402840
margin: 2px 0;
2841-
display: inline-block !important;
2841+
display: inline-flex !important;
28422842
line-height: 1.3em; // there is a `font-size: 1.25em` for inside emoji, so here the line-height needs to be larger slightly
28432843
}
28442844

2845-
// Scoped labels with different colors on left and right, and slanted divider in the middle
2845+
// Scoped labels with different colors on left and right
28462846
.scope-parent {
28472847
background: none !important;
28482848
padding: 0 !important;
@@ -2851,23 +2851,12 @@
28512851
.ui.label.scope-left {
28522852
border-bottom-right-radius: 0;
28532853
border-top-right-radius: 0;
2854-
padding-right: 0;
2855-
margin-right: 0;
2856-
}
2857-
2858-
.ui.label.scope-middle {
2859-
width: 12px;
2860-
border-radius: 0;
2861-
padding-left: 0;
2862-
padding-right: 0;
2863-
margin-left: 0;
28642854
margin-right: 0;
28652855
}
28662856

28672857
.ui.label.scope-right {
28682858
border-bottom-left-radius: 0;
28692859
border-top-left-radius: 0;
2870-
padding-left: 0;
28712860
margin-left: 0;
28722861
}
28732862

0 commit comments

Comments
 (0)