atom-material / atom-material-ui

A dynamic UI theme for Atom that follows Google's Material Design Guidelines
MIT License
817 stars 203 forks source link

Predefined colors impossible to use on Atom v1.25.0-beta0 #462

Open Arcanemagus opened 6 years ago

Arcanemagus commented 6 years ago

[Short description of problem here]

Reproduction Steps:

  1. Open Atom v1.25.0-beta0 with atom-material-ui installed
  2. Attempt to set a predefined color (eg. "Green")

Expected behavior:

Predefined color to be set.

Observed behavior:

These errors are printed to the console:

Error setting item in object: Validation failed at atom-material-ui.colors.abaseColor, {"_alpha":1,"_blue":117,"_green":216,"_red":170} cannot be coerced into a color
coerce @ <embedded>:22846
executeSchemaEnforcers @ <embedded>:21894
coerce @ <embedded>:22844
executeSchemaEnforcers @ <embedded>:21894
makeValueConformToSchema @ <embedded>:22641
set @ <embedded>:22207
transact @ <embedded>:22458
transact @ <embedded>:22320
resetUserSettings @ <embedded>:22455
disposables.add.applicationDelegate.onDidChangeUserSettings.settings @ <embedded>:1040
outerCallback @ <embedded>:1895
emitThree @ events.js:121
emit @ events.js:197

Error setting item in object: Validation failed at atom-material-ui.colors.accentColor, {"_alpha":1,"_blue":83,"_green":136,"_red":111} cannot be coerced into a color

And then after a very short delay the theme reverts to the default (Teal).

Screenshots and GIFs

2018-02-13_13-49-08

Atom version:

Atom    : 1.25.0-beta0
Electron: 1.7.11
Chrome  : 58.0.3029.110
Node    : 7.9.0

OS and version:

Windows 10 x64 Enterprise

Installed packages:

Installed packages ``` Dev Packages (3) C:\Users\abneyl\.atom\dev\packages ├── linter-csslint@2.0.0 ├── linter-eslint@8.4.1 └── linter-flake8@2.3.0 Community Packages (81) C:\Users\abneyl\.atom\packages ├── atom-beautify@0.30.9 ├── atom-ide-ui@0.8.1 (disabled) ├── atom-material-ui@2.1.1 ├── autocomplete-lua@0.9.0 ├── busy-signal@1.4.3 (disabled) ├── docblockr@0.13.6 ├── editorconfig@2.2.2 ├── file-watcher@1.2.6 (disabled) ├── highlight-selected@0.13.1 ├── ide-flowtype@0.19.0 ├── ide-php@0.7.5 ├── ide-python@0.7.0 ├── ide-typescript@0.7.2 ├── intentions@1.1.5 (disabled) ├── language-ansible@0.2.2 ├── language-chef@0.11.0 ├── language-cjson@0.0.1 ├── language-docker@1.1.8 ├── language-elixir@0.22.0 ├── language-erlang@3.2.0 ├── language-fortran@2.1.6 ├── language-gettext@0.6.1 ├── language-glsl@2.0.4 ├── language-haml@0.25.2 ├── language-haskell@1.17.3 ├── language-icinga2@0.4.1 ├── language-ini@1.19.0 ├── language-jade@0.7.2 ├── language-jolie@0.5.0 ├── language-kotlin@0.5.0 ├── language-livescript@0.0.3 ├── language-lua@0.9.11 ├── language-moonscript@1.7.1 ├── language-postcss@1.3.1 ├── language-powershell@4.0.0 ├── language-pug@0.0.22 ├── language-puppet@0.23.0 ├── language-r@0.4.2 ├── language-reg@0.0.0 ├── language-rust@0.4.12 ├── language-swift@0.5.0 ├── language-terraform@0.8.1 ├── language-vue@0.23.1 ├── linter@2.2.0 ├── linter-coffeelint@1.3.1 ├── linter-eslint@8.4.1 ├── linter-flake8@2.3.0 ├── linter-htmlhint@1.4.0 ├── linter-js-standard@4.2.0 ├── linter-js-yaml@1.2.8 ├── linter-jsonlint@1.3.0 ├── linter-markdown@5.2.0 ├── linter-perl@0.8.1 ├── linter-perlcritic@2.0.0 ├── linter-php@1.5.1 ├── linter-phpcs@1.6.8 ├── linter-phpmd@2.0.0 ├── linter-proselint@3.3.0 ├── linter-pylama@0.9.5 ├── linter-pylint@2.1.1 ├── linter-rails-best-practices@0.2.2 (disabled) ├── linter-reek@2.2.2 ├── linter-rubocop@2.2.3 ├── linter-ruby@1.2.6 ├── linter-stylelint@4.2.0 ├── linter-tidy@2.3.1 ├── linter-ui-default@1.6.10 ├── linter-ui-plus@0.3.2 (disabled) ├── mapfile-grammar@0.1.0 ├── minimap@4.29.7 ├── minimap-git-diff@4.3.1 ├── minimap-highlight-selected@4.6.1 ├── minimap-linter@2.1.3 ├── minimap-selection@4.5.0 ├── sequential-number@0.5.0 ├── sort-lines@0.18.0 ├── tab-control@0.6.10 ├── teletype@0.7.0 ├── terminal-tab@0.5.0 ├── toggle-quotes@1.1.0 └── trailing-spaces@0.4.0 ```
phyllisstein commented 6 years ago

Same results on macOS when trying to set theme colors with the color picker, for what it's worth.

Evpok commented 6 years ago

Same on Linux (Plasma/X11), with both predefined and colour picker.

Nxt3 commented 6 years ago

Setting the colors works for me--but every time Atom is opened I have to re-select the colors.

alexdevero commented 6 years ago

I have the same issue as @Nxt3. The color setting works only until Atom is closed. Colors are reset after Atom is opened again.

alexdevero commented 6 years ago

A workaround until this issue is fixed:

1) Open init script (File -> Init Script ...) 2) Add following code to "force-change" theme base colors when Atom start

# Force-set theme base (primary) color 
atom.config.set('atom-material-ui.colors.abaseColor', 'rgba(0, 166, 255, 1)')

# Force-set theme base (secondary) color 
atom.config.set('atom-material-ui.colors.accentColor', 'rgba(0, 166, 255, 1)')

There might be a small lag of a second or two before colors are applied.

silvestreh commented 6 years ago

I'm having the issue where it resets the colors back to default values on startup. I already have a fix for that (the fix I had broke other stuff), but I cannot reproduce the one in OP

Evpok commented 6 years ago

Trying to reproduce today I too only have the issue on startup and not the one in OP.

phyllisstein commented 6 years ago

I've had luck reproducing the original issue when multiple Atom windows are open. My understanding is that each window runs through the "startup" process independently, so that might be contributing to the quick-fallback behavior.

silvestreh commented 6 years ago

@phyllisstein thanks for that! at a first glance, it looks like it's an issue with Atom itself, but I'll have to investigate further and hopefully find a workaround.

On the bright side, I now did find a fix for the color resetting issue. I'll be pushing an update in the next couple minutes.

Arcanemagus commented 6 years ago

Sorry, just to be clear it wouldn't surprise me at all if this was an issue with the beta, it includes an update to Electron which usually has unintended side effects. I was busy filing and fixing a bunch of other things that popped up and forgot to come back here to do more detailed testing 😉.

silvestreh commented 6 years ago

@Arcanemagus, yeah totes. I'll keep an eye on this though.

phyllisstein commented 6 years ago

Sad to say the fix only seems to work until you pop open a new Atom window. Attached a screencast to demonstrate.

screenflow

robertrossmann commented 6 years ago

This is most likely not related to this package - I have observed similar issues with platformio-ide-terminal package where configuration values which represent colours in hex format are for some reason automatically re-formatted into an object with individual colour components (_alpha, _red, _green, _blue which in turn caused the packages depending on that configuration value to fail to understand this format.

So I'd bet this is related to Atom 1.25-beta.0.

Arcanemagus commented 6 years ago

@50Wliu could this have been broken by https://github.com/atom/atom/pull/16161 somehow?

50Wliu commented 6 years ago

I would be super-surprised if it was. I can't guarantee I'll have time to investigate but if I do I'll try reverting that PR and seeing if it helps.

Arcanemagus commented 6 years ago

I know from past investigations that .toString() gets called on the values sent in, which is why I'm suspicious of it.

50Wliu commented 6 years ago

Not caused by atom/atom#16161. Especially since .toString() would have previously returned [object Object] anyway which would have been even more incorrect. A different PR that may be related is https://github.com/atom/atom/pull/16628.

Arcanemagus commented 6 years ago

This is definitely caused by https://github.com/atom/atom/pull/16628, I built https://github.com/atom/atom/commit/a48624dc0255458a4bd73ffca02a545080a9d34a and it had no issues, building https://github.com/atom/atom/commit/e74ea4797521c845f040638d01d41a1677c9ddb8 (since https://github.com/atom/atom/commit/2923f0057f5acec94f638546432f50e9a027da0c was giving me a few issues I skipped ahead 3 commits) and I can replicate this issue when using a second window.

I'll file an issue on atom/atom about this. @silvestreh feel free to close this or leave it open to make it obvious to find for others hitting this issue 😉.