@@ -224,6 +238,8 @@
import 'flatpickr/dist/flatpickr.css'
import multiselect from 'vue-multiselect'
import {differenceWith} from 'lodash'
+ import verte from 'verte'
+ import 'verte/dist/verte.css'
import ListService from '../../services/list'
import TaskService from '../../services/task'
@@ -273,6 +289,7 @@
components: {
flatPickr,
multiselect,
+ verte,
},
props: {
task: {
diff --git a/src/components/tasks/gantt-component.vue b/src/components/tasks/gantt-component.vue
index d346a019..87fe309e 100644
--- a/src/components/tasks/gantt-component.vue
+++ b/src/components/tasks/gantt-component.vue
@@ -28,8 +28,9 @@
{
return new LabelModel(l)
})
+
+ // Set the default color
+ if (this.hexColor === '') {
+ this.hexColor = '198CFF'
+ }
+ if (this.hexColor.substring(0, 1) !== '#') {
+ this.hexColor = '#' + this.hexColor
+ }
}
defaults() {
@@ -48,7 +56,8 @@ export default class TaskModel extends AbstractModel {
reminderDates: [],
subtasks: [],
parentTaskID: 0,
-
+ hexColor: '',
+
createdBy: UserModel,
created: 0,
updated: 0,
@@ -101,4 +110,23 @@ export default class TaskModel extends AbstractModel {
}
}
}
+
+ /**
+ * Checks if the hexColor of a task is dark.
+ * @returns {boolean}
+ */
+ hasDarkColor() {
+ if (this.hexColor === '#') {
+ return true // Defaults to dark
+ }
+
+ let rgb = parseInt(this.hexColor.substring(1, 7), 16); // convert rrggbb to decimal
+ let r = (rgb >> 16) & 0xff; // extract red
+ let g = (rgb >> 8) & 0xff; // extract green
+ let b = (rgb >> 0) & 0xff; // extract blue
+
+ // luma will be a value 0..255 where 0 indicates the darkest, and 255 the brightest
+ let luma = 0.2126 * r + 0.7152 * g + 0.0722 * b; // per ITU-R BT.709
+ return luma > 128
+ }
}
\ No newline at end of file
diff --git a/src/services/task.js b/src/services/task.js
index 1bbecbe5..f3e0c1fd 100644
--- a/src/services/task.js
+++ b/src/services/task.js
@@ -69,6 +69,10 @@ export default class TaskService extends AbstractService {
}
model.repeatAfter = repeatAfterSeconds
+ if (model.hexColor.substring(0, 1) === '#') {
+ model.hexColor = model.hexColor.substring(1, 7)
+ }
+
return model
}
}
\ No newline at end of file
diff --git a/src/styles/gantt.scss b/src/styles/gantt.scss
index 3c425f8c..372f0cba 100644
--- a/src/styles/gantt.scss
+++ b/src/styles/gantt.scss
@@ -78,8 +78,31 @@ $gantt-vertical-border-color: lighten($grey, 45);
user-select: none; // Non-prefixed version, currently supported by Chrome and Opera
&.is-current-edit {
- border-color: $orange;
- background: lighten($orange, 40);
+ border-color: $orange !important;
+ }
+
+ &.has-light-text {
+ color: $light;
+
+ &.done span:after {
+ border-top: 1px solid $light;
+ }
+
+ .edit-toggle {
+ color: $light;
+ }
+ }
+
+ &.has-dark-text {
+ color: $dark;
+
+ &.done span:after {
+ border-top: 1px solid $dark;
+ }
+
+ .edit-toggle {
+ color: $dark;
+ }
}
&.done span {
@@ -87,7 +110,6 @@ $gantt-vertical-border-color: lighten($grey, 45);
&:after {
content: '';
- border-top: 1px solid $dark;
position: absolute;
right: 0;
left: 0;
diff --git a/todo.md b/todo.md
index c3778570..d995e65d 100644
--- a/todo.md
+++ b/todo.md
@@ -50,7 +50,7 @@
* [x] Overdue rot anzeigen
* [x] Beim Team bearbeiten Nutzer suchen einbauen
* [ ] Keyboard shortcuts
-* [ ] Gantt chart
+* [x] Gantt chart
* [x] Basics
* [x] Add tasks without dates set
* [x] Edit tasks with a kind of popup when clicking on them - needs refactoring edit task into an own component
@@ -58,7 +58,7 @@
* [x] Be able to choose the range for the chart
* [x] Show task priority
* [x] Show task done or not done
- * [ ] Colors - needs api change before
+ * [x] Colors - needs api change before
* [x] More view modes
* [x] Month: "The big picture"
* [x] Day: 3-hour slices of a day