Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add configuration for task-bar text color #128

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ npm start
| | | - **backgroundSelectedColor**: String. Specifies the taskbar background fill color locally on select. |
| | | - **progressColor**: String. Specifies the taskbar progress fill color locally. |
| | | - **progressSelectedColor**: String. Specifies the taskbar progress fill color globally on select. |
| | | - **textColor**: String. Specifies the taskbar text fill color locally. |
| isDisabled | bool | Disables all action for current task. |
| fontSize | string | Specifies the taskbar font size locally. |
| project | string | Task project name |
Expand Down
6 changes: 6 additions & 0 deletions src/components/task-item/task-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ export const TaskItem: React.FC<TaskItemProps> = props => {
}
};

const getTextColor = (): string => {
if (task.styles.textColor) return task.styles.textColor;
else return isTextInside ? "#FFF" : "#555";
};

return (
<g
onKeyDown={e => {
Expand Down Expand Up @@ -116,6 +121,7 @@ export const TaskItem: React.FC<TaskItemProps> = props => {
? style.barLabel
: style.barLabel && style.barLabelOutside
}
fill={getTextColor()}
ref={textRef}
>
{task.name}
Expand Down
8 changes: 0 additions & 8 deletions src/components/task-item/task-list.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.barLabel {
fill: #fff;
text-anchor: middle;
font-weight: lighter;
dominant-baseline: central;
Expand All @@ -12,12 +11,5 @@
}

.barLabelOutside {
fill: #555;
text-anchor: start;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
pointer-events: none;
}
1 change: 1 addition & 0 deletions src/types/bar-task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface BarTask extends Task {
backgroundSelectedColor: string;
progressColor: string;
progressSelectedColor: string;
textColor?: string;
};
}

Expand Down
1 change: 1 addition & 0 deletions src/types/public-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface Task {
backgroundSelectedColor?: string;
progressColor?: string;
progressSelectedColor?: string;
textColor?: string;
};
isDisabled?: boolean;
project?: string;
Expand Down