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: use different colors on text selection/highlight dark/light mode #338

13 changes: 13 additions & 0 deletions assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,16 @@ p + p {
.nuxt-scroll-indicator {
@apply bg-gradient-to-r to-secondary from-blue-700;
}

/* We use this color just one time */
.light {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's easier to use tailwind syntax here, for example:

::selection: {
	@apply bg-[#d4b5d4] dark:bg-primary
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your comment. I just realized that if we want to have different colors for different modes, we should use something like this.

::selection {
  @apply bg-secondary; // for light mode
}

.dark ::selection {
  @apply bg-primary;; // for dark mode
}

or if we want to use only one color for each mode, we can use your solution.
Let me know what you think about it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@yaroslavhoretskyi Ah yes you're right, thanks

::selection {
background: #d4b5d4;
}
}

.dark {
::selection {
@apply bg-primary;
}
}