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

Peacock writes colors on open or reload when no peacock color is chosen #480

Closed
talamaska opened this issue Nov 16, 2021 · 10 comments
Closed
Assignees

Comments

@talamaska
Copy link

Versions (please complete the following information):

  • OS: Windows 10
  • VS Code version 1.62.2
  • Peacock Version 3.11.0

Describe the bug
I have edited manually colors to this

  "workbench.colorCustomizations": {
    "activityBar.background": "#0d2c1399",
    "activityBar.activeBackground": "#0d2c1399",
    "activityBar.activeBorder": "#81DA7F",
    "activityBar.foreground": "#81DA7F",
    "activityBar.inactiveForeground": "#e7e7e799",
    "activityBarBadge.background": "#81DA7F",
    "activityBarBadge.foreground": "#0d2c1399",
    "titleBar.activeBackground": "#0d2c1399",
    "titleBar.inactiveBackground": "#091f0d99",
    "titleBar.activeForeground": "#81DA7F",
    "titleBar.inactiveForeground": "#e7e7e799",
    "statusBar.background": "#237e33",
    "statusBarItem.hoverBackground": "#2ea643",
    "statusBar.foreground": "#e7e7e7",
    "editorGroup.border": "#2ea643",
    "panel.border": "#2ea643",
    "sash.hoverBorder": "#2ea643",
    "sideBar.border": "#2ea643",
    "statusBarItem.remoteBackground": "#237e33",
    "statusBarItem.remoteForeground": "#e7e7e7"
  }

I don't have peacock.color setting.

After i close and then start the VS code again, colors are reset to something different and the peacock.color is set to something that I have not choose.

To Reproduce
Copy the setting I have placed there

Expected behavior
I don't expect peacock to invent some color and change the look of my editor even if the plugin is enabled.

Screenshots
image
image

@johnpapa
Copy link
Owner

Thank you @talamaska for creating this issue!

@johnpapa
Copy link
Owner

Fantastic ! Thank you for the great information on this. I was able to repro this in the video below.

It seems that when starting VS Code (or reloading) that Peacock is checking if there is a color, and if so, it activates its logic.

I will dig into this to find out why. I would expect that if no color is set that it would not activate its logic, as you mentioned.

But I suspect there is more to this ... so let me circle back and see what I can find.

2021-11-16_22-21-05 (1)

@johnpapa johnpapa self-assigned this Nov 17, 2021
@johnpapa johnpapa changed the title Theme reset Peacock writes colors on open or reload when no peacock color is chosen Nov 17, 2021
@johnpapa johnpapa added the bug Something isn't working label Nov 17, 2021
@johnpapa
Copy link
Owner

I found why this is happening.

  • Old versions of Peacock did not store the peacock color or stored it in a memento.
  • Version 3+ of Peacock stores the color in the settings.
  • If peacock.color does not exist and we find either memento or a derived color (activity bar, title bar, status bar),
  • remove the memento, and apply the color to the settings.
  • @deprecated since version 3.0.
  • Will be deleted in version 4.0 and once v3.0 users have migrated

As peacock is installed 1.4 million instances of vscode, I did not want to have a breaking change to existing users. This logic was put in place to help automatically migrate users from older versions to newer ones. I will remove this when we go to version 4, which may be about time.

Why does it exist?

  1. Without this logic, users of older versions of peacock wouldnt work.
  2. If a user with an older version of peacock updates Peacock, this logic will auto migrate them. Which means they wont need this logic moving forward.

The idea here was to help users migrate, without them needing to do anything. Thus, after time, most users would already be migrated. This plan seems to have worked very well as this is the first issue in more than a year on this topic.

Is it needed anymore?

I could remove this logic and shift to version 4 now, as it would be a breaking change. And my gut says it is time (almost 2 years since v3). This is the only change driving a new version at this time, so that Is something to consider.

I could also modify the logic to not check for the existing derived colors, which is what you are running into. This logic exists as a reasonable way for Peacock to determine if it should apply a color. But w/o this logic, it would be difficult to make a reasonable color choice.

So I am leaning to deprecating the code. But before I do this, I want to keep checking to make sure it doesnt affect anything else.

@johnpapa johnpapa removed the bug Something isn't working label Nov 17, 2021
@johnpapa
Copy link
Owner

fixed in #481

@johnpapa johnpapa reopened this Nov 17, 2021
@johnpapa
Copy link
Owner

Re-opening as this solved one part of a problem, but the logic still exists for good reasons to clear the settings.

For now, it is unavoidable that Peacock when enabled will clear all workspace customizations in the local settings.json file. I will add this to the documentation.

If you wish to set your own colors, you will need to disable Peacock.

staying open til I set the docs.

@talamaska
Copy link
Author

talamaska commented Nov 17, 2021

Seems reasonable. This is what I did actually. Disabled Peacock. The problem with peacock is that I'm unable to create such the as the previous screenshot. Anyways looking for the future version. I did not encounter this problem before, because I never tried to set my own colors to create such theme. If I use peacock only to set the theme color everything is fine. I wonder if it is a better solution for peacock to store 2-3 colors instead of just one. Sure that might be overwhelming and will make it difficult to set via the vs code menu.

@johnpapa
Copy link
Owner

johnpapa commented Feb 6, 2022

Appreciate the feedback on this.

Closing this as given the explanations above.

@paustint
Copy link

@johnpapa - Sorry to comment on a closed issue, but was wondering if there is any possibility of an alternative here?
I have one project I own that is open source and I have customized the settings to use colors that are branded for the project, so that any developers that work on the project get the custom color theme.

But for all my other projects/workspaces, I do want to continue using peacock.
I can't seem to find a solution for this - I can disable for myself for the workspace, but I would like to make sure any other developer that opens the project and happens to have peacock installed doesn't overwrite the settings. (workaround right now for me would be to ask for changes in PR if they happened to be committed)

Ideally there would be some way to opt-out of this extension in .vscode/settings.json so it would apply automatically to the project.... In a perfect world this would be a feature of VScode, but based on this isue which would solve the problem, there is a lot of controversy for some reason.

@igorakkerman
Copy link

I tried out Peacock and immediately came across this issue. I wanted to modify some of the color values created by Peacock but it kept restoring them. I removed the "peacock.color" line and was suddenly left with a broken json file:

{
,
}

The file didn't exist before but apparently, Peacock always leaves the comma in.

While I tried to understand the reasoning above, to me, this "all or nothing" approach is a non-starter.
The usage of Peacock should be opt-in.
It should be possible to, at least temporarily, disable Peacock for a workspace without breaking the settings. It should be possible to modify specific values without Peacock overwriting them.

I suggest a mandatory setting for Peacock to operate in the first place:

"peacock.enable": true

For those reasons, unfortunately, I will not continue to use this extension. I will now create a configuration for each of my workspaces and then uninstall Peacock. After it is no longer active, I will remove any Peacock related setting from the workspaces, leaving nothing but the color configurations.

I'd be willing to support you in creating issues if you were to modify the behavior and also test it afterwards.

@paustint
Copy link

I would like to call out that is is still super annoying.

I have an open source repository where I like to set very specific editor colors to match the branding of the project. It is mostly just me that works on the repo, but there are a few others - but I do work on multiple computers.

I try to disable the extension for this repo, but over time as I change computers etc.. this annoyance keeps creeping up.

Here is all I would like:
Give me the option to either disable the extension for a specific workspace.
OR give me an option not to wipe out colorCustomizations if I have not specified a specific color for this workspace.

Here is the change made every time the extension loads and I have to revert that change over and over. (which I am expert at now! 🥷 )

"workbench.colorCustomizations": {
-  "activityBar.activeBackground": "#111827",
-  "activityBar.activeBorder": "#3FD9EC",
-  "activityBar.background": "#111827",
-  "activityBar.foreground": "#e7e7e7",
-  "activityBar.inactiveForeground": "#e7e7e799",
-  "activityBarBadge.background": "#3FD9EC",
-  "activityBarBadge.foreground": "#111827",
-  "statusBar.background": "#111827",
-  "statusBar.foreground": "#e7e7e7",
-  "statusBarItem.hoverBackground": "#626d86",
-  "titleBar.activeBackground": "#111827",
-  "titleBar.activeForeground": "#e7e7e7",
-  "titleBar.inactiveBackground": "#11182799",
-  "titleBar.inactiveForeground": "#e7e7e799",
-  "sash.hoverBorder": "#111827",
-  "statusBarItem.remoteBackground": "#111827",
-  "statusBarItem.remoteForeground": "#e7e7e7",
-  "commandCenter.border": "#e7e7e799"
+  "activityBar.activeBorder": "#3FD9EC"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants