darklaf icon indicating copy to clipboard operation
darklaf copied to clipboard

Add test for rendering of UI accents and selection

Open vlsi opened this issue 4 years ago • 2 comments

Accent and selection can be changed from the command line, so it should be possible to

  1. change settings via command line
  2. launch demo, capture screenshots

Here's the source: https://www.reddit.com/r/MacOS/comments/9xtg0y/switching_system_appearance_using_terminal/e9wemy8/

I'm not sure how to generate "UI style updated" in realtime, however, executing defaults write -g AppleAccentColor -int 3 before launching the demo works.

#  Appearance
defaults write -globalDomain "AppleInterfaceStyle" -string "Dark"
#  to Disable: delete entry

#  Accent colour
#  this setting defines two properties:
#    - AppleAccentColor
#    - AppleAquaColorVariant
#  it also presets AppleHighlightColor, but this can be overriden
#
#  note that AppleAquaColorVariant is alway "1" except for "Graphite", where it is "6".
#  note that the AccentColor "Blue" is default (when there is no entry) and has no AppleHighlightColor definition.
#
#  Color    AppleAquaColorVariant    AccentColor    AppleHighlightColor
#    Red            1                   0           "1.000000 0.733333 0.721569 Red"
#    Orange         1                   1           "1.000000 0.874510 0.701961 Orange"
#    Yellow         1                   2           "1.000000 0.937255 0.690196 Yellow"
#    Green          1                   3           "0.752941 0.964706 0.678431 Green"
#    Purple         1                   5           "0.968627 0.831373 1.000000 Purple"
#    Pink           1                   6           "1.000000 0.749020 0.823529 Pink"
#    Blue           1                   deleted     deleted
#    Graphite       6                   -1          "0.847059 0.847059 0.862745 Graphite"
defaults write -globalDomain "AppleAquaColorVariant" -int 6
defaults write -globalDomain "AccentColor" -int -1

#  Highlight colour
#  set to Pink
defaults write -globalDomain "AppleHighlightColor" -string "1.000000 0.749020 0.823529 Pink"

vlsi avatar Apr 10 '20 12:04 vlsi

Does defaults write -globalDomain "AppleHighlightColor" -string "1.000000 0.749020 0.823529 Pink" actually work for you. On github actions:

Runtime.getRuntime.exec("defaults write -globalDomain "AppleHighlightColor" -string \"1.000000 0.749020 0.823529 Pink\"");

produces 2020-04-10 20:12:11.994 defaults[1277:10469] Unexpected argument 0.733333; leaving defaults unchanged.

weisJ avatar Apr 10 '20 20:04 weisJ

Ok. Invoking the command specifically using bash -c does work. However the changes are only applied if the settings are reopened. Maybe this script could work: https://apple.stackexchange.com/questions/332003/toggle-light-mode-dark-mode-and-accent-color-from-one-to-another

weisJ avatar Apr 11 '20 14:04 weisJ