1
1
import $ from 'jquery' ;
2
- import { useLightTextOnBackground } from '../utils/color.js' ;
3
- import tinycolor from 'tinycolor2' ;
4
2
import { createSortable } from '../modules/sortable.js' ;
5
3
6
4
const { csrfToken} = window . config ;
@@ -109,14 +107,10 @@ export function initRepoProject() {
109
107
110
108
$ ( '.edit-project-column-modal' ) . each ( function ( ) {
111
109
const projectHeader = $ ( this ) . closest ( '.project-column-header' ) ;
112
- const projectTitleLabel = projectHeader . find ( '.project-column-title' ) ;
110
+ const projectTitleLabel = projectHeader . find ( '.project-column-issue- title' ) ;
113
111
const projectTitleInput = $ ( this ) . find ( '.project-column-title-input' ) ;
114
112
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' ) ;
120
114
121
115
$ ( this ) . find ( '.edit-project-column-button' ) . on ( 'click' , function ( e ) {
122
116
e . preventDefault ( ) ;
@@ -132,10 +126,7 @@ export function initRepoProject() {
132
126
} ) . done ( ( ) => {
133
127
projectTitleLabel . text ( projectTitleInput . val ( ) ) ;
134
128
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` ) ;
139
130
$ ( '.ui.modal' ) . modal ( 'hide' ) ;
140
131
} ) ;
141
132
} ) ;
@@ -209,15 +200,6 @@ export function initRepoProject() {
209
200
} ) ;
210
201
}
211
202
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
-
221
203
function rgbToHex ( rgb ) {
222
204
rgb = rgb . match ( / ^ r g b a ? \( ( \d + ) , \s * ( \d + ) , \s * ( \d + ) .* \) $ / ) ;
223
205
return `#${ hex ( rgb [ 1 ] ) } ${ hex ( rgb [ 2 ] ) } ${ hex ( rgb [ 3 ] ) } ` ;
0 commit comments