Skip to content

Commit 0346a4b

Browse files
committed
fix: update project-column-issue-count’s color rather than the whole column
when edit color && fix bugs caused by eb14787
1 parent b2f828d commit 0346a4b

File tree

3 files changed

+9
-25
lines changed

3 files changed

+9
-25
lines changed

templates/projects/view.tmpl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,15 @@
6464
<div id="project-board">
6565
<div class="board {{if .CanWriteProjects}}sortable{{end}}">
6666
{{range .Columns}}
67-
<div class="ui segment project-column" style="background: {{.Color}} !important;" data-id="{{.ID}}" data-sorting="{{.Sorting}}" data-url="{{$.Link}}/{{.ID}}">
67+
<div class="ui segment project-column" data-id="{{.ID}}" data-sorting="{{.Sorting}}" data-url="{{$.Link}}/{{.ID}}">
6868
<div class="project-column-header">
6969
<div class="ui large label project-column-title gt-py-2">
70-
<div class="ui small circular grey label project-column-issue-count">
70+
<div class="ui small circular grey label project-column-issue-count" style="background: {{.Color}} !important;">
7171
{{.NumIssues ctx}}
7272
</div>
73-
{{.Title}}
73+
<div class="ui project-column-issue-title">
74+
{{.Title}}
75+
</div>
7476
</div>
7577
{{if and $canWriteProject (ne .ID 0)}}
7678
<div class="ui dropdown jump item">

web_src/css/themes/theme-gitea-light.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@
204204
--color-hover: #00000014;
205205
--color-active: #0000001b;
206206
--color-menu: #fafafa;
207-
--color-card: #fafafa;
207+
--color-card: #ffffff;
208208
--color-markup-table-row: #00000008;
209209
--color-markup-code-block: #00000010;
210210
--color-button: #fafafa;

web_src/js/features/repo-projects.js

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import $ from 'jquery';
2-
import {useLightTextOnBackground} from '../utils/color.js';
3-
import tinycolor from 'tinycolor2';
42
import {createSortable} from '../modules/sortable.js';
53

64
const {csrfToken} = window.config;
@@ -109,14 +107,10 @@ export function initRepoProject() {
109107

110108
$('.edit-project-column-modal').each(function () {
111109
const projectHeader = $(this).closest('.project-column-header');
112-
const projectTitleLabel = projectHeader.find('.project-column-title');
110+
const projectTitleLabel = projectHeader.find('.project-column-issue-title');
113111
const projectTitleInput = $(this).find('.project-column-title-input');
114112
const projectColorInput = $(this).find('#new_project_column_color');
115-
const boardColumn = $(this).closest('.project-column');
116-
117-
if (boardColumn.css('backgroundColor')) {
118-
setLabelColor(projectHeader, rgbToHex(boardColumn.css('backgroundColor')));
119-
}
113+
const projectColumnIssueCount = $(this).closest('.project-column').find('.project-column-issue-count');
120114

121115
$(this).find('.edit-project-column-button').on('click', function (e) {
122116
e.preventDefault();
@@ -132,10 +126,7 @@ export function initRepoProject() {
132126
}).done(() => {
133127
projectTitleLabel.text(projectTitleInput.val());
134128
projectTitleInput.closest('form').removeClass('dirty');
135-
if (projectColorInput.val()) {
136-
setLabelColor(projectHeader, projectColorInput.val());
137-
}
138-
boardColumn.attr('style', `background: ${projectColorInput.val()}!important`);
129+
projectColumnIssueCount.attr('style', `background: ${projectColorInput.val()}!important`);
139130
$('.ui.modal').modal('hide');
140131
});
141132
});
@@ -209,15 +200,6 @@ export function initRepoProject() {
209200
});
210201
}
211202

212-
function setLabelColor(label, color) {
213-
const {r, g, b} = tinycolor(color).toRgb();
214-
if (useLightTextOnBackground(r, g, b)) {
215-
label.removeClass('dark-label').addClass('light-label');
216-
} else {
217-
label.removeClass('light-label').addClass('dark-label');
218-
}
219-
}
220-
221203
function rgbToHex(rgb) {
222204
rgb = rgb.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+).*\)$/);
223205
return `#${hex(rgb[1])}${hex(rgb[2])}${hex(rgb[3])}`;

0 commit comments

Comments
 (0)