-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Introduce themable colors for resolved and unresolved comments #145230
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
Introduce themable colors for resolved and unresolved comments #145230
Conversation
307d2ba
to
85d7be7
Compare
85d7be7
to
73743b9
Compare
73743b9
to
f1d8d94
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks and works great! I left a few comments, but I intend to push changes to address them today so that I can merge this before we start our endgame next week.
After our endgame week we'll do a UX review, try to get feedback from other extension authors, and work towards finalizing the API.
} | ||
|
||
set state(newState: vscode.CommentThreadState) { | ||
this._state = newState; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhere in this file we need to have a call to checkProposedApiEnabled
, probably in set state
to enforce our API proposal mechanism.
@@ -57,6 +57,21 @@ const COLLAPSE_ACTION_CLASS = 'expand-review-action ' + ThemeIcon.asClassName(co | |||
const COMMENT_SCHEME = 'comment'; | |||
|
|||
|
|||
export const resolvedCommentBorder = registerColor('resolvedComment.border', { dark: Color.fromHex('#c5c5c5'), light: Color.fromHex('#555'), hc: contrastBorder }, nls.localize('resolvedCommentBorder', 'Color of borders and arrow for resolved comments.')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaning towards calling these 'comments.resolved.border'
and 'comments.unresolved.border
', respectively.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note for myself for later: we might need to registerThemingParticipant
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
registerThemingParticipant
is not needed because you're using a CSS variable 👌
const commentThreadStateColorVar = '--comment-thread-state-color'; | ||
|
||
function getCommentThreadStateColor(thread: languages.CommentThread, theme: IColorTheme): Color | undefined { | ||
const colorId = thread.state !== undefined ? commentThreadStateColors.get(thread.state) : undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the thread.state
is undefined, we should use the peekViewBorder
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made the changes I commented on so that we can merge this before our endgame starts. Thank you for the PR!
There's an outage that's preventing me from merging this right now, but I will merge it when that's over. |
const colorId = thread.state !== undefined ? commentThreadStateColors.get(thread.state) : undefined; | ||
return colorId !== undefined ? theme.getColor(colorId) : undefined; | ||
function getCommentThreadWidgetStateColor(thread: languages.CommentThread, theme: IColorTheme): Color | undefined { | ||
return getCommentThreadStateColor(thread, theme) ?? theme.getColor(peekViewBorder); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this maybe just be inlined in getCommentThreadStateColor()
? Having two separate methods leads to slightly confusing naming for me, which seems like a code smell, especially since we won't use getCommentThreadStateColor()
independently of getCommentThreadStateColor()
from what I can see. Not a very strong opinion though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I split it out in preparation for including the color in the "Comments" view. There, we will not use the peek view color, but I do expect that we still use the same resolved/unresolved colors.
I just realized I had forgotten to upload the local changes I had made yesterday to base the unresolved colors on |
Implementation proposal for #127473.