Get rid of jQuery.Color from jquery-ui

This commit is contained in:
Hadi Nategh 2022-05-05 15:55:49 +02:00
parent 8df2a2fc49
commit a8bcdd88b0
5 changed files with 6120 additions and 25 deletions

View File

@ -28,7 +28,7 @@ import {
egwActionObjectInterface
} from "../egw_action/egw_action.js";
import {Et2Dialog} from "./Et2Dialog/Et2Dialog";
import {ColorTranslator} from 'colortranslator';
/**
* Class which implements the UI of a Portlet
*
@ -399,7 +399,7 @@ export class et2_portlet extends et2_valueWidget
{
this.options.color = color;
this.header.css("backgroundColor", color);
this.header.css('color', jQuery.Color(this.header.css("backgroundColor")).lightness() > 0.5 ? 'black':'white');
this.header.css('color', (new ColorTranslator(this.header.css("backgroundColor"))).L > 50 ? 'black':'white');
this.content.css("backgroundColor", color);
}

View File

@ -28,6 +28,7 @@ import {holidays} from "../../api/js/etemplate/Et2Date/Holidays";
import {et2_calendar_view} from "./et2_widget_view";
import flatpickr from "flatpickr";
import {formatDate} from "../../api/js/etemplate/Et2Date/Et2Date";
import {ColorTranslator} from "colortranslator";
/**
* Class which implements the "calendar-timegrid" XET-Tag for displaying a single days
@ -856,7 +857,7 @@ export class et2_calendar_daycol extends et2_valueWidget implements et2_IDetache
{
// Avoid white, which is hard to see
// Use border-bottom-color, Firefox doesn't give a value with border-color
const color = jQuery.Color(event.div.css('background-color')).toString() !== jQuery.Color('white').toString() ?
const color = (new ColorTranslator(event.div.css('background-color'))).RGB !== 'rgb(255,255,255)' ?
event.div.css('background-color') : event.div.css('border-bottom-color');
if(color !== 'rgba(0, 0, 0, 0)')
{

View File

@ -27,6 +27,7 @@ import {et2_selectbox} from "../../api/js/etemplate/et2_widget_selectbox";
import {et2_container} from "../../api/js/etemplate/et2_core_baseWidget";
import {Et2Dialog} from "../../api/js/etemplate/Et2Dialog/Et2Dialog";
import {formatTime} from "../../api/js/etemplate/Et2Date/Et2Date";
import {ColorTranslator} from "colortranslator";
/**
* Class for a single event, displayed in either the timegrid or planner view
@ -375,11 +376,11 @@ export class et2_calendar_event extends et2_valueWidget implements et2_IDetached
.append('<span class="calendar_calEventTitle">' + title + '</span>');
// Colors - don't make them transparent if there is no color
// @ts-ignore
if (jQuery.Color("rgba(0,0,0,0)").toRgbaString() != jQuery.Color(this.div, 'background-color').toRgbaString())
const bg_color = new ColorTranslator(this.div.css('background-color'));
if (bg_color.RGBA != 'rgb(0,0,0,0)')
{
// Most statuses use colored borders
this.div.css('border-color', this.div.css('background-color'));
this.div.css('border-color', bg_color.RGBA);
}
this.icons.appendTo(this.title)

6128
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -65,7 +65,8 @@
"@shoelace-style/shoelace": "^2.0.0-beta.73",
"blueimp-gallery": "^3.4.0",
"lit-flatpickr": "^0.3.0",
"sortablejs": "^1.14.0"
"sortablejs": "^1.14.0",
"colortranslator": "^1.9.2"
},
"engines": {
"node": ">=14.0.0"