-
Notifications
You must be signed in to change notification settings - Fork 163
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
Pasting dark mode content becomes light mode #2870
Comments
Hello @miku1958, This is by design, and this is more a copy issue than paste issue. The content that is wrote to the clipboard by vscode is already containing the background color as black. So, when that content is pasted in the editor, there is no way for us to identify whether the clipboard content is in Dark mode or not, so we just transform the content to the inverse colors. For example: The HTML clipboard content looks like this, see that the parent div already contains the background color as black.
Pasting the clipboard content to a normal HTML file and opening it looks like this: And since the Rooster editor is already in Dark mode we inverse the colors that vscode wrote to the clipboard. |
Hi @BryanValverdeU I was thinking it would be nice to have an option to keep the clipboard contents in dark mode. |
I dont see a problem adding a new paste type for this requirement. But the consumer of the paste API should determine whether the content is in dark mode or not to use this paste type (Can be done passing the getPasteTypeGetter)
@miku1958 would you like to contribute with this change? |
In an ideal world we would detect whether the content in the clipboard is dark or light, and choose to reverse the colors or not depending on it. But that's a difficult thing to do correctly, especially if the content has mixed coloring. Having an alternative paste type would be a nice way to give API consumers or even users a way to choose the right paste for them. |
@jvillalobos I have some questions about the expected behavior, assume we copy from VSCode with dark background, then what are the expected behavior in the following cases with this paste option:
|
To be clear, I'm not suggesting we change anything in the default behavior in Rooster or Outlook for the time being, but I see the value in adding the option via API. But, thinking forward, I think what we should aim for is to determine the light/dark mode of the content in the clipboard and then decide if the color should be reversed or not, aiming to match the current light/dark mode of the editor. To figure out the mode I'm guessing that involves looking at the background color of the container, and if there is none, looking at the font color, but I imagine it's much more complex. The alternative, and possibly easier approach, is to offer users a way to reverse the color of the pasted content manually. So, if the content doesn't match, they can go to the paste options, reverse the color, and see if that works better for them. |
I agree. |
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Paste content keep dark mode
Device Information
The text was updated successfully, but these errors were encountered: