Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Further improvements to Dark mode - #3806

Merged
fregante merged 12 commits into
refined-github:masterfrom
mcornella:fix/darkmode-coloring
Dec 19, 2020
Merged

Further improvements to Dark mode#3806
fregante merged 12 commits into
refined-github:masterfrom
mcornella:fix/darkmode-coloring

Conversation

@mcornella

@mcornella mcornella commented Dec 9, 2020

Copy link
Copy Markdown
Contributor

I believe this PR fixes all Dark mode issues, so close issue #3798 once this is merged if you agree.


  1. LINKED ISSUES:
    Fix border issues in Support for Github Darkmode #3798:

  2. TEST URLS:

  3. SCREENSHOTS:

Before After
pinned issues - before pinned issues - after
Before After
grouped events divider line - before grouped events divider line - after

Since this PR uses the --github-border-color CSS variable already present in the codebase, this automatically fixes other border colors that use this variable. This includes table-input cell borders in comments:

Before After
table-input cells - before table-input cells - after

This is a better approach than making --github-border-color a fallback like I did in the previous PR since it requires less changes.


More fixes

  1. Feature: parse-backticks. Use the --color-markdown-code-bg CSS variable to color the background in backticks parsed by the parse-backticks feature. To find the appropriate CSS variable I inspected the CSS of code elements in Markdown content (you can do it yourself with this very comment). First reported here.

    Before After
    before after
  2. Feature: split-issue-pr-search-results. In a GitHub search, remove the background color in split Issues and PRs, then fix the color when hovering by using the --color-menu-bg-active CSS variable. I had to use .menu-item to add specificity to the selector, otherwise it could be done with !important.

    Before After
    before after
  3. Feature: resolve-conflicts. When resolving a conflict, the first line number background uses the light color. We use --color-auto-yellow-1 instead which is the coloring used by GitHub, and since --github-faint-yellow isn't used in any other place of the codebase, I removed it from :root and replaced its value.

    Before After
    before after
  4. Feature: many. Some features that use --github-green and --github-red appeared darker than the colors that GitHub uses now (--color-text-success and --color-text-danger).

    Red color:

    Before After
    before after

    Green color:

    Before After
    before after
  5. Feature: show-whitespace. Fix the color of whitespace glyphs (fixes Adjust show-whitespace color so it also works in dark mode #3772).

    Before After
    before after
  6. Feature: table-input. Soften the blue background color of cells.

    image image

  7. Feature: conflict-marker. Use a darker color for Dark mode (#505050).

    before after

  8. Feature: emphasize-draft-pr-label. Make it less bright on dark mode.

    before after

  9. Feature: highlight-collaborators-and-own-conversations. Dim collaborator/own indicator border in PR lists

    before after

  10. Feature: reactions-avatars. Fix reaction avatars in dark mode: (1) make the box-shadow color match the background, and (2) use a darker background color in avatars for when the image didn't load.

    before after

Comment thread source/features/reactions-avatars.css
@mcornella mcornella changed the title Fix general border color for Dark mode Other color fixes for Dark mode Dec 10, 2020
@mcornella

Copy link
Copy Markdown
Contributor Author

Added another fix for the background of parsed backticks text.

BTW, I found that commit lists in PR conversations is no longer parsed correctly:
image
I found that the commit-message class is no longer applied (I understand it was previously, based off the feature code?). The js-commit class is, though it's applied to the whole timeline item, but with this the feature works correctly again:

diff --git a/source/features/parse-backticks.tsx b/source/features/parse-backticks.tsx
index 4ee24d39..dbdf32ae 100644
--- a/source/features/parse-backticks.tsx
+++ b/source/features/parse-backticks.tsx
@@ -13,7 +13,7 @@ function init(): void {
         '.js-commits-list-item .mb-1, .js-commits-list-item pre', // `isCommitList` commit message and description
         '.Details[data-issue-and-pr-hovercards-enabled] .d-none a.link-gray-dark', // `isRepoRoot` commit message
         '.commit-title, .commit-desc', // `isCommit` commit message and description
-        '.commit-message', // `isPRConversation`, `isCompare`, `isReleasesOrTags` pushed commits
+        '.commit-message, .js-commit', // `isPRConversation`, `isCompare`, `isReleasesOrTags` pushed commits
         '.blame-commit-message', // `isBlame` commit message
         'a[id^="issue_"]', // `isConversationList` issue and PR title
         '.TimelineItem-body > del, .TimelineItem-body > ins', // `isIssue`, `isPRConversation` title edits

If I'm correct in my assessment, which I'm not sure, this is more an effect of the new GitHub UI version push and not an issue with dark mode, since light mode has the same markup. Should I push it here as well or make another commit?

@yakov116

Copy link
Copy Markdown
Member

Separate PR

@kidonng

kidonng commented Dec 11, 2020

Copy link
Copy Markdown
Member

@mcornella Yeah this is what I mentioned in #3798 (comment):

(And I remember seeing unparsed backticks some time ago, but that's another topic though)

If you don't mind, I can open a separate PR to validate all selectors 😃

@mcornella

mcornella commented Dec 11, 2020

Copy link
Copy Markdown
Contributor Author

@kidonng sorry, I had the branch ready yesterday. I pushed #3812, with an added fix for correctness (commit number 2).

EDIT: you could still make a PR checking the rest of the selectors, I'm not familiar with them enough to know where in the GitHub UI they apply. You can even cherry-pick my commits and put them all into a single PR if you want.

@fregante

Copy link
Copy Markdown
Member

Can you react with 🚀 on each comment that this PR fixes in the main issue? So I mark them as resolved once I merge it

@mcornella

Copy link
Copy Markdown
Contributor Author

Done!

@fregante

Copy link
Copy Markdown
Member

Thanks! Are there any other hardcoded colors in the extension or should I merge this?

@cheap-glitch

Copy link
Copy Markdown
Contributor

Thanks! Are there any other hardcoded colors in the extension or should I merge this?

Maybe #3772 could be also fixed in this PR?

@kidonng

kidonng commented Dec 13, 2020

Copy link
Copy Markdown
Member

@kidonng sorry, I had the branch ready yesterday. I pushed #3812, with an added fix for correctness (commit number 2).

EDIT: you could still make a PR checking the rest of the selectors, I'm not familiar with them enough to know where in the GitHub UI they apply. You can even cherry-pick my commits and put them all into a single PR if you want.

@mcornella I will be busy for a couple of days, so go ahead if you find anything broken. I will comment on your PR if I have the time.

@mcornella

Copy link
Copy Markdown
Contributor Author

Some features that use --github-green and --github-red appear darker than the colors that GitHub uses now (--color-text-success and --color-text-danger). This doesn't constitute a bug but I wonder if I should add these in the definition of --github-green and --github-red?

Before After
before after
Before After
before after

@mcornella

Copy link
Copy Markdown
Contributor Author

Going through features that have color changes I stumbled upon extend-status-labels.css. Should this have been removed alongside extend-status-labels.tsx in b8614bd?

@mcornella

mcornella commented Dec 13, 2020

Copy link
Copy Markdown
Contributor Author

Alright, I've checked the files in source/ for color strings: rgb/a, hsl/a, #rgb and its variants, color and CSS color names. This is the result:

Fixed
source/features/clean-dashboard.css
source/features/clean-pinned-issues.css
source/features/parse-backticks.css
source/features/resolve-conflicts.css
source/features/show-whitespace.css
source/features/split-issue-pr-search-results.css
source/features/table-input.css
source/refined-github.css
Checked and working
source/features/center-reactions-popup.css
source/features/clean-conversation-headers.css
source/features/clean-footer.css
source/features/clean-mergeability-box.css
source/features/conflict-marker.css
source/features/deep-reblame.css
source/features/emphasize-draft-pr-label.css
source/features/extend-diff-expander.css
source/features/extend-status-labels.css
source/features/faster-pr-diff-options.tsx
source/features/first-published-tag-for-merged-pr.tsx
source/features/git-checkout-pr.tsx
source/features/hidden-review-comments-indicator.css
source/features/hide-comments-faster.tsx
source/features/hide-readme-header.css
source/features/hide-useless-comments.css
source/features/highest-rated-comment.css
source/features/highest-rated-comment.tsx
source/features/highlight-collaborators-and-own-conversations.css
source/features/highlight-deleted-and-added-files-in-diffs.tsx
source/features/linkify-user-edit-history-popup.tsx
source/features/mark-merge-commits-in-list.css
source/features/mark-private-orgs.css
source/features/pinned-issues-update-time.tsx
source/features/pr-approvals-count.css
source/features/pr-commit-lines-changed.tsx
source/features/quick-fork-deletion.css
source/features/quick-mention.css
source/features/reactions-avatars.css
source/features/release-download-count.tsx
source/features/remove-label-faster.css
source/features/remove-label-faster.tsx
source/features/repo-age.tsx
source/features/show-associated-branch-prs-on-fork.tsx
source/features/submit-review-as-single-comment.tsx
source/features/suggest-commit-title-limit.css
source/features/useful-not-found-page.tsx
source/features/user-local-time.tsx
source/features/user-profile-follower-badge.tsx
source/features/wait-for-build.css

Pending #3772 and #3806 (comment) this is almost ready.


These are the grep results sorted by result, in case anybody's interested:

Details
# Checked
source/features/center-reactions-popup.css:57:	color: #4078c0;
source/features/clean-conversation-headers.css:2:	background-color: #0366d6;
source/features/clean-conversation-headers.css:6:	color: #fff;
source/features/clean-footer.css:19:	color: #666;
source/features/clean-mergeability-box.css:14:	color: inherit;
source/features/clean-mergeability-box.css:20:	color: var(--github-red);
source/features/conflict-marker.css:3:	color: #c0c0c0;
source/features/deep-reblame.css:2:	color: #e40de48c;
source/features/deep-reblame.css:6:	color: #8000808c;
source/features/emphasize-draft-pr-label.css:2:	stroke: #586069;
source/features/emphasize-draft-pr-label.css:4:	color: #fff !important;
source/features/extend-diff-expander.css:4:	border-color: #0366d6;
source/features/extend-diff-expander.css:5:	color: #fff;
source/features/extend-diff-expander.css:6:	background: #0366d6;
source/features/extend-status-labels.css:8:	color: #fff !important;
source/features/faster-pr-diff-options.tsx:50:			className={`btn btn-sm btn-outline tooltipped tooltipped-s ${isHidingWhitespace ? 'bg-gray-light text-gray-light' : ''}`}
source/features/first-published-tag-for-merged-pr.tsx:37:			<TagIcon className="mx-1 text-gray-light v-align-middle"/>,
source/features/git-checkout-pr.tsx:36:			{remote && <p className="text-gray text-small my-1">{remoteType}</p>}
source/features/git-checkout-pr.tsx:83:			<p className="text-gray text-small">
source/features/hidden-review-comments-indicator.css:20:	color: transparent;
source/features/hidden-review-comments-indicator.css:32:	color: inherit;
source/features/hide-comments-faster.tsx:40:	hideCommentForm.classList.add('dropdown-menu', 'dropdown-menu-sw', 'text-gray-dark', 'show-more-popover', 'anim-scale-in');
source/features/hide-readme-header.css:10:	background-color: transparent !important;
source/features/hide-useless-comments.css:4:	color: #586069;
source/features/hide-useless-comments.css:8:	border-color: var(--github-red);
source/features/hide-useless-comments.css:8:	border-color: var(--github-red);
source/features/highest-rated-comment.css:18:	--color-auto-gray-1: var(--color-auto-green-1);
source/features/highest-rated-comment.css:18:	--color-auto-gray-1: var(--color-auto-green-1);
source/features/highest-rated-comment.css:19:	--color-auto-blue-4: var(--color-auto-green-4);
source/features/highest-rated-comment.css:19:	--color-auto-blue-4: var(--color-auto-green-4);
source/features/highest-rated-comment.css:2:	border: 2px solid #2cbe4e !important;
source/features/highest-rated-comment.css:20:	--color-auto-blue-2: var(--color-auto-green-2);
source/features/highest-rated-comment.css:20:	--color-auto-blue-2: var(--color-auto-green-2);
source/features/highest-rated-comment.css:24:	--color-bg-tertiary: var(--color-auto-green-1);
source/features/highest-rated-comment.css:24:	--color-bg-tertiary: var(--color-auto-green-1);
source/features/highest-rated-comment.tsx:53:	avatar.append(<CheckIcon width={24} height={32} className="mt-4 text-green"/>);
source/features/highest-rated-comment.tsx:58:			className="d-flex flex-items-center text-green mr-1 tooltipped tooltipped-n"
source/features/highest-rated-comment.tsx:80:			<a href={hash} className="no-underline rounded-1 rgh-highest-rated-comment timeline-comment bg-gray px-2 d-flex flex-items-center">
source/features/highest-rated-comment.tsx:86:				<span className="text-gray timeline-comment-header-text">
source/features/highlight-collaborators-and-own-conversations.css:2:	border: 1px solid #c0d3eb;
source/features/highlight-deleted-and-added-files-in-diffs.tsx:46:				icon.classList.add('text-green');
source/features/highlight-deleted-and-added-files-in-diffs.tsx:48:				icon.classList.add('text-red');
source/features/linkify-user-edit-history-popup.tsx:15:			wrap(avatar.nextElementSibling!, <a className="link-gray-dark" href={`/${userName}`}/>);
source/features/mark-merge-commits-in-list.css:6:	color: #4078c0;
source/features/mark-private-orgs.css:10:	fill: #333;
source/features/mark-private-orgs.css:11:	stroke: #fff;
source/features/pinned-issues-update-time.tsx:48:			<span className="text-gray d-inline-block">
source/features/pr-approvals-count.css:10:	color: var(--github-green);
source/features/pr-approvals-count.css:15:	color: var(--github-red) !important;
source/features/pr-commit-lines-changed.tsx:34:			<span className="text-green">+{additions}</span>{' '}
source/features/pr-commit-lines-changed.tsx:35:			<span className="text-red">−{deletions}</span>{' '}
source/features/quick-fork-deletion.css:8:	background-color: var(--color-scale-red-6);
source/features/quick-fork-deletion.css:8:	background-color: var(--color-scale-red-6);
source/features/quick-mention.css:12:	color: inherit;
source/features/reactions-avatars.css:17:	--background: #f2f8fa;
source/features/reactions-avatars.css:27:	background: #efefef; /* Placeholder before the images load */
source/features/reactions-avatars.css:28:	box-shadow: 0 0 0 2px var(--background, #fff);
source/features/reactions-avatars.css:47:	background-color: var(--background);
source/features/reactions-avatars.css:7:	border-top: 1px solid var(--github-border-color); /* Required when the second line is longer than the first line */
source/features/reactions-avatars.css:8:	border-bottom: 1px solid var(--github-border-color); /* Required when the first line is longer than the second line */
source/features/release-download-count.tsx:72:					const classes = 'rgh-release-download-count mr-2 text-gray' + (index === 0 ? ' text-bold' : '');
source/features/remove-label-faster.css:19:	background-color: currentColor;
source/features/remove-label-faster.css:20:	fill: var(--rgh-remove-label-faster-color);
source/features/remove-label-faster.css:5:	color: inherit !important;
source/features/remove-label-faster.tsx:51:						'--rgh-remove-label-faster-color': label.style.backgroundColor
source/features/repo-age.tsx:120:		<li className="text-gray" title={`First commit dated ${dateFormatter.format(birthday)}`}>
source/features/show-associated-branch-prs-on-fork.tsx:62:	Open: '--green',
source/features/show-associated-branch-prs-on-fork.tsx:63:	Closed: '--red',
source/features/show-associated-branch-prs-on-fork.tsx:64:	Merged: '--purple',
source/features/submit-review-as-single-comment.tsx:15:	<button className="rgh-submit-single btn-link ml-2 text-gray text-small" type="button">Send now</button>
source/features/suggest-commit-title-limit.css:3:	border-color: var(--github-red);
source/features/suggest-commit-title-limit.css:4:	background-color: rgb(203 36 49 / 3%);
source/features/suggest-commit-title-limit.css:9:	box-shadow: inset 0 1px 2px rgb(35 27 27 / 7.5%), 0 0 0 0.2em rgb(203 36 49 / 30%);
source/features/useful-not-found-page.tsx:21:	return <del style={{color: '#6a737d'}}>{text}</del>;
source/features/user-local-time.tsx:110:			<div className="rgh-local-user-time mt-2 text-gray text-small">
source/features/user-profile-follower-badge.tsx:26:			newProfileElement.after(<span className="text-gray"> · Follows you</span>);
source/features/wait-for-build.css:4:	color: #808080;

# Fixed
source/features/clean-dashboard.css:19:	background-color: var(--color-bg-canvas, #fff);
source/features/clean-dashboard.css:20:	border: 1px solid var(--github-border-color);
source/features/clean-dashboard.css:66:	border-top: 1px solid var(--github-border-color);
source/features/clean-pinned-issues.css:14:		box-shadow: 0 0 0 2px var(--github-border-color);
source/features/clean-pinned-issues.css:22:		border-color: var(--github-border-color) !important;
source/features/parse-backticks.css:3:	background-color: var(--color-markdown-code-bg, rgb(27 31 35 / 5%));
source/features/resolve-conflicts.css:3:	background-color: var(--github-faint-yellow);
source/features/show-whitespace.css:15:	background-image: url('data:image/svg+xml,%3Csvg preserveAspectRatio="xMinYMid meet" viewBox="0 0 12 24" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M9.5 10.44L6.62 8.12L7.32 7.26L12.04 11V11.44L7.28 14.9L6.62 13.9L9.48 11.78H0V10.44H9.5Z" fill="rgba(36,41,46,25%)"/%3E%3C/svg%3E');
source/features/show-whitespace.css:20:	background-image: url('data:image/svg+xml,%3Csvg preserveAspectRatio="xMinYMid meet" viewBox="0 0 12 24" xmlns="http://www.w3.org/2000/svg"%3E%3Cpath d="M4.5 11C4.5 10.1716 5.17157 9.5 6 9.5C6.82843 9.5 7.5 10.1716 7.5 11C7.5 11.8284 6.82843 12.5 6 12.5C5.17157 12.5 4.5 11.8284 4.5 11Z" fill="rgba(36,41,46,25%)"/%3E%3C/svg%3E');
source/features/split-issue-pr-search-results.css:2:	background-color: #f6f8fa;
source/features/table-input.css:16:	border: 2px solid var(--github-border-color);
source/features/table-input.css:21:	border-color: #79b8ff;
source/features/table-input.css:22:	background-color: #dbedff;
source/refined-github.css:2:    --github-green: var(--color-text-success, #28a745);
source/refined-github.css:3:    --github-red: var(--color-text-danger, #cb2431);
source/refined-github.css:4:    --github-gray-background: #fafbfc;
source/refined-github.css:5:    --github-gray-text: #6a737d;
source/refined-github.css:6:    --github-border-color: var(--color-border-primary, #e1e4e8);
source/refined-github.css:76:   color: #6a737d;

And I used these two commands:

grep -n -rE '(rgb|rgba|hsl|hsla)\(|#([0-9a-f]{3}){1,2}([0-9a-f]{2}|\b)|color' source/ | sort -u
grep -n -rE '\b(aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgrey|darkgreen|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|grey|green|greenyellow|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgrey|lightgreen|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen)\b' source/ | sort -u

@fregante

Copy link
Copy Markdown
Member

Going through features that have color changes I stumbled upon extend-status-labels.css. Should this have been removed alongside extend-status-labels.tsx in b8614bd?

Can be done in a future lint PR.

Comment thread source/refined-github.css Outdated
Comment thread source/refined-github.css
@fregante

Copy link
Copy Markdown
Member

After the 2 comments are fixed, let's merge this, together with #3812, and release a new hotfix version.

@fregante

fregante commented Dec 15, 2020

Copy link
Copy Markdown
Member

This is still too bright:

Screen Shot 2020-12-14 at 20 52 57

Compared to:
Screen Shot 2020-12-14 at 20 52 51

This can also be fixed separately if you don't have time, so we can merge this PR earlier.

@mcornella

mcornella commented Dec 15, 2020

Copy link
Copy Markdown
Contributor Author

This is still too bright:

  1. Current
  2. Using --color-scale-blue-1
  3. Using --color-auto-blue-1
  4. Using --color-diff-blob-hunk-num-bg

All CSS variables have the same value as the current one for light mode.

image image image image

Which one do you prefer?

@fregante

Copy link
Copy Markdown
Member

4 looks good.

In a separate PR (maybe with #3823), I wonder how it would look if we dropped the spacing between each cell, so it looks like an actual table

@mcornella

mcornella commented Dec 15, 2020

Copy link
Copy Markdown
Contributor Author

Replying to #3798 (comment):

  • own username’s border is too bright

Using --color-border-tertiary which is the closest one to the current color. Doesn't make it stand out from the text, so I don't know if this is better.

First screenshot is the current color:
image image image

The other option is to target [data-color-mode='dark'] and pick a different color.


  • conflicts icon is too bright

Went with #505050 for this one (targets [data-color-mode='dark']):

image


  • the "draft PR" icon should not be so bright

Using --color-text-tertiary for the stroke and --color-bg-canvas for the color (light mode should look the same):

image image


  • the reaction avatars should not have a border, that's meant to be "invisible"

Tried really hard on this one. When user has reacted, the box-shadow should be --color-bg-info, but it has a transparency so the color combines with the background of the parent element, making it different.

image

After that, I used the color picker to pick the exact color of the background (without transparency), but GitHub changes the background color when the viewport is less than 544px, so when the reactions are zoomed in there is a visible border (notice the black background in the second pic):

image
image

I went with this last option because it's not that common that people will be looking at stuff with a 544px viewport, but I'd love some feedback on this. I could add a media query but is it really worth it?

Patch
diff --git a/source/features/conflict-marker.css b/source/features/conflict-marker.css
index 537103c2..04906514 100644
--- a/source/features/conflict-marker.css
+++ b/source/features/conflict-marker.css
@@ -2,3 +2,7 @@
 	vertical-align: middle;
 	color: #c0c0c0;
 }
+
+[data-color-mode='dark'] .rgh-conflict-marker svg {
+	color: #505050;
+}
diff --git a/source/features/emphasize-draft-pr-label.css b/source/features/emphasize-draft-pr-label.css
index 0f561279..8f2cf418 100644
--- a/source/features/emphasize-draft-pr-label.css
+++ b/source/features/emphasize-draft-pr-label.css
@@ -1,7 +1,7 @@
 .js-issue-row [aria-label='Open draft pull request'] svg {
-	stroke: #586069;
+	stroke: var(--color-text-secondary, #586069);
 	stroke-width: 1.2px;
-	color: #fff !important;
+	color: var(--color-bg-canvas, #fff) !important;
 	paint-order: stroke;
 	overflow: visible !important;
 }
diff --git a/source/features/highlight-collaborators-and-own-conversations.css b/source/features/highlight-collaborators-and-own-conversations.css
index 86184a93..7bd5215c 100644
--- a/source/features/highlight-collaborators-and-own-conversations.css
+++ b/source/features/highlight-collaborators-and-own-conversations.css
@@ -1,5 +1,5 @@
 .rgh-collaborator {
-	border: 1px solid #c0d3eb;
+	border: 1px solid var(--color-border-tertiary, #c0d3eb);
 	border-radius: 2em;
 	padding: 2px 5px;
 }
diff --git a/source/features/reactions-avatars.css b/source/features/reactions-avatars.css
index 9f2d76eb..18049c54 100644
--- a/source/features/reactions-avatars.css
+++ b/source/features/reactions-avatars.css
@@ -17,6 +17,10 @@ button.reaction-summary-item { /* `button` excludes the "Add reaction" icon */
 	--background: #f2f8fa;
 }
 
+[data-color-mode='dark'] .reaction-summary-item.user-has-reacted {
+	--background: #111d2f;
+}
+
 .reaction-summary-item a {
 	display: inline-block;
 	width: 2em;
@@ -25,10 +29,14 @@ button.reaction-summary-item { /* `button` excludes the "Add reaction" icon */
 	margin-left: -0.5em;
 	vertical-align: middle;
 	background: #efefef; /* Placeholder before the images load */
-	box-shadow: 0 0 0 2px var(--background, #fff);
+	box-shadow: 0 0 0 2px var(--background, var(--color-bg-primary, #fff));
 	font-size: 10px; /* Base sizer */
 }
 
+[data-color-mode='dark'] .reaction-summary-item a {
+	background: #101010; /* Placeholder before the images load */
+}
+
 .reaction-summary-item a:first-of-type {
 	margin-left: 0.5em;
 }

@fregante

Copy link
Copy Markdown
Member

No need to force push because it makes it hard to know what changed

@mcornella

Copy link
Copy Markdown
Contributor Author

The only commit I modified was 0ea87d7 where I only removed the extra CSS variables and added a comment. I've yet to commit #3806 (comment), let me know what you think about each proposal and I'll make the commits.

@fregante

Copy link
Copy Markdown
Member

Looks good

Comment thread source/features/reactions-avatars.css Outdated
@@ -25,10 +29,14 @@ button.reaction-summary-item { /* `button` excludes the "Add reaction" icon */
margin-left: -0.5em;
vertical-align: middle;
background: #efefef; /* Placeholder before the images load */

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use an existing variable here instead?

@mcornella mcornella Dec 18, 2020

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no variable in https://primer.style/primitives/ that corresponds with #efefef for light mode. This is using --color-bg-canvas-inset (to not make it pure white on light mode):

User has reacted:
image
image

Normal:
image
image

@fregante fregante left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this it can probably be merged

}

[data-color-mode='dark'] .rgh-conflict-marker svg {
color: #505050;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use a variable too, the color doesn't need to be exactly what it was. If it's near enough as long as it looks good

stroke: var(--color-text-secondary, #586069);
stroke-width: 1.2px;
color: #fff !important;
color: var(--color-bg-canvas, #fff) !important;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is more appropriate, without using important, I don't know if it works

Suggested change
color: var(--color-bg-canvas, #fff) !important;
fill: var(--color-bg-canvas, #fff);

@fregante fregante changed the title Other color fixes for Dark mode Further improvements to Dark mode Dec 19, 2020
@fregante
fregante merged commit eb79224 into refined-github:master Dec 19, 2020
@mcornella
mcornella deleted the fix/darkmode-coloring branch December 19, 2020 16:42
@mcornella

mcornella commented Dec 19, 2020

Copy link
Copy Markdown
Contributor Author

Sorry, I saw the last comments just now. Thanks for merging!

@fregante

Copy link
Copy Markdown
Member

Yeah I don’t like ever-increasing long-living PRs, especially for bug fixes, it’s best to limit the scope and merge often. The remaining comments and further improvements can be done in a new PR

@fregante

Copy link
Copy Markdown
Member

It looks like the color doesn't work for your own reactions. See here:

Screen Shot 3

@mcornella

mcornella commented Jan 10, 2021

Copy link
Copy Markdown
Contributor Author

I specifically targeted this in https://github.com/sindresorhus/refined-github/pull/3806/files#diff-da8c7be7c768eb7bc8b49010c3f06209916a1d2282d2069d10646b13731582fdR20, has something changed?

EDIT: still works for me:
image

@shinenelson

Copy link
Copy Markdown
Contributor

the background of the emoji too is white for me because

.reaction-summary-item img {
  background-color: var(--background)
}

image

apparently, the specifically dark mode targeted fix has not worked for me either.

@mcornella

Copy link
Copy Markdown
Contributor Author

Can you post a screenshot of the Styles panel of the element in devtools? Also, is data-color-mode=dark still an attribute of the <html> tag?

@shinenelson

Copy link
Copy Markdown
Contributor

Also, is data-color-mode=dark still an attribute of the tag?

Ah, damn, that was the issue for me - my data-color-mode was auto because I have system-wide dark mode enabled and Firefox seems to honor the system setting by default. I manually changed the value of the attribute to dark in DevTools and it worked as expected.

Personally, I do not want to set dark mode explicitly. I would rather let my global setting be honored wherever possible. So I guess I will have to live with this 🤦‍♂️

@shinenelson

Copy link
Copy Markdown
Contributor

can we maybe change the CSS rule to use prefers-color-scheme: dark rather than use the data-color-mode? I am not sure how this would affect the rest of the extension though.

@mcornella

mcornella commented Jan 17, 2021

Copy link
Copy Markdown
Contributor Author

That's right I hadn't thought about this case. All the CSS selectors that use [data-color-mode=dark] should also target

@media (prefers-color-scheme: dark) {
	[data-color-mode=auto] {

There are not many that use this, you can quickly see them in the Files tab of this PR. Unfortunately I don't have time for this, but it should be a quick fix for anyone trying.

shinenelson added a commit to shinenelson/refined-github that referenced this pull request Jan 18, 2021
for `prefers-color-scheme: dark` @media query
and `[data-color-mode: auto]`

reference : refined-github#3806 (comment)
shinenelson added a commit to shinenelson/refined-github that referenced this pull request Jan 18, 2021
for `prefers-color-scheme: dark` @media query
and `[data-color-mode: auto]`

reference : refined-github#3806 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

Adjust show-whitespace color so it also works in dark mode

7 participants