feat: improved coloring scheme

This commit is contained in:
Safwan Samsudeen 2024-04-20 11:11:43 +05:30
parent 769233a71a
commit 4f66e83eaa
4 changed files with 64 additions and 43 deletions

View File

@ -29,7 +29,7 @@ export default class Arrow {
this.from_task.task._index + this.from_task.task._index +
this.gantt.options.padding; this.gantt.options.padding;
const end_x = this.to_task.$bar.getX() - this.gantt.options.padding / 2; const end_x = this.to_task.$bar.getX() - this.gantt.options.padding / 2 - 7;
const end_y = const end_y =
this.gantt.options.header_height + this.gantt.options.header_height +
this.gantt.options.bar_height / 2 + this.gantt.options.bar_height / 2 +

View File

@ -34,7 +34,7 @@ export default class Bar {
this.duration * this.duration *
(this.task.progress / 100) || 0; (this.task.progress / 100) || 0;
this.group = createSVG("g", { this.group = createSVG("g", {
class: "bar-wrapper " + (this.task.custom_class || ""), class: "bar-wrapper " + (this.task.custom_class || "") + (this.task.important && 'important'),
"data-id": this.task.id, "data-id": this.task.id,
}); });
this.bar_group = createSVG("g", { this.bar_group = createSVG("g", {

View File

@ -1,17 +1,20 @@
@import "./dark.scss"; @import "./dark.scss";
$bar-color: #b8c2cc !default; $bar-color: #fff !default;
$bar-stroke: #8d99a6 !default; $bar-color-important: #94c4f4 !default;
$bar-stroke: #fff !default;
$border-color: #e0e0e0 !default; $border-color: #e0e0e0 !default;
$light-bg: #f5f5f5 !default; $light-bg: #f5f5f5 !default;
$light-border-color: #ebeff2 !default; $light-border-color: #ebeff2 !default;
$light-yellow: #f6e796 !default; $light-yellow: #f6e796 !default;
$holiday-color: #EEE !default; $holiday-color: #f3f4f7 !default;
$text-muted: #666 !default; $text-muted: #666 !default;
$text-light: #555 !default; $text-light: #fff !default;
$text-color: #333 !default; $text-dark: #333 !default;
$blue: #acacfa !default; $progress-important: #2c94ec !default;
$handle-color: #ddd !default; $progress: #dedfe0 !default;
$handle-color: #dcdce4 !default;
$handle-color-important: #94c4f4 !default;
$light-blue: #c4c4e9 !default; $light-blue: #c4c4e9 !default;
.gantt { .gantt {
@ -32,9 +35,9 @@ $light-blue: #c4c4e9 !default;
fill: #ffffff; fill: #ffffff;
} }
.grid-row:nth-child(even) { // .grid-row:nth-child(even) {
fill: $light-bg; // fill: $light-bg;
} // }
.row-line { .row-line {
stroke: $light-border-color; stroke: $light-border-color;
@ -91,7 +94,7 @@ $light-blue: #c4c4e9 !default;
.bar-progress { .bar-progress {
fill: $blue; fill: $progress;
} }
.date-highlight { .date-highlight {
@ -115,19 +118,38 @@ $light-blue: #c4c4e9 !default;
} }
.bar-label { .bar-label {
fill: #fff; fill: $text-dark;
dominant-baseline: central; dominant-baseline: central;
// text-anchor: middle; // text-anchor: middle;
font-family: Helvetica; font-family: Helvetica;
font-size: 13px; font-size: 14px;
font-weight: 600; font-weight: 400;
&.big { &.big {
fill: $text-light; fill: $text-dark;
text-anchor: start; text-anchor: start;
} }
} }
.bar-wrapper.important {
.bar {
fill: $bar-color-important;
}
.bar-progress {
fill: $progress-important;
}
.bar-label {
fill: $text-light;
}
.handle {
fill: $handle-color-important;
}
}
.handle { .handle {
fill: $handle-color; fill: $handle-color;
cursor: ew-resize; cursor: ew-resize;
@ -145,19 +167,27 @@ $light-blue: #c4c4e9 !default;
.bar-wrapper { .bar-wrapper {
cursor: pointer; cursor: pointer;
.bar {
outline: groove 1px black;
border-radius: 3px;
}
&.important .bar {
outline: none; outline: none;
outline-width: 1.5px;
&:active {
outline: 1px dotted;
}
}
&:hover { &:hover {
.bar { .bar {
fill: darken($bar-color, 5); outline-width: 1.5px;
transition: transform 0.3s ease;
} }
.bar-progress {
fill: darken($blue, 5);
}
.date-highlight { .date-highlight {
display: block; display: block;
} }
@ -165,11 +195,7 @@ $light-blue: #c4c4e9 !default;
&.active { &.active {
.bar { .bar {
fill: darken($bar-color, 5); outline-style: dotted;
}
.bar-progress {
fill: darken($blue, 5);
} }
} }
} }
@ -180,12 +206,10 @@ $light-blue: #c4c4e9 !default;
text-anchor: middle; text-anchor: middle;
} }
.upper-text {
fill: $text-light;
}
.lower-text { .lower-text,
fill: $text-color; .upper-text {
fill: $text-dark;
} }
.hide { .hide {
@ -209,7 +233,7 @@ $light-blue: #c4c4e9 !default;
border-radius: 3px; border-radius: 3px;
.title { .title {
border-bottom: 3px solid $blue; border-bottom: 3px solid $progress;
padding: 10px; padding: 10px;
} }

View File

@ -475,13 +475,10 @@ export default class Gantt {
const x = (date_utils.diff(d, this.gantt_start, 'hour') / const x = (date_utils.diff(d, this.gantt_start, 'hour') /
this.options.step) * this.options.step) *
this.options.column_width; this.options.column_width;
const height = const height = (this.options.bar_height + this.options.padding) * this.tasks.length;
(this.options.bar_height + this.options.padding) * this.tasks.length +
this.options.header_height +
this.options.padding / 2;
createSVG('rect', { createSVG('rect', {
x, x,
y: 0, y: this.options.header_height + this.options.padding / 2,
width: (this.view_is('Day') ? 1 : 2) * this.options.column_width, width: (this.view_is('Day') ? 1 : 2) * this.options.column_width,
height, height,
class: 'holiday-highlight', class: 'holiday-highlight',