Yaru テーマのボタンの色を変更するにはどうすればいいですか?

Yaru テーマのボタンの色を変更するにはどうすればいいですか?

色を変えたいオレンジ他の何かに閉じるボタンやるテーマ
編集することでどのように実行できますか?cssファイル?

答え1

回避策

OS: Ubuntu 19.10
GTKテーマ: Yaru
アイコンテーマ: Yaru

/usr/share/themes/Yaru/gtk-3.20/以下のコマンドでgtk.cssファイルを開きます。

sudo -H gedit /usr/share/themes/Yaru/gtk-3.20/gtk.css

既存のテキストの下に以下のコードを貼り付け、必要に応じて色を変更します。

  headerbar button.titlebutton:not(.appmenu).close,
  .titlebar button.titlebutton:not(.appmenu).close,
  headerbar.selection-mode button.titlebutton:not(.appmenu).close, button.titlebutton:not(.appmenu).close {
    color: #ffffff;
    background-image: -gtk-gradient(radial, center center, 0, center center, 0.35714, to(#E95420), to(transparent)); }
    headerbar button.titlebutton:not(.appmenu).close:hover,
    .titlebar button.titlebutton:not(.appmenu).close:hover,
    headerbar.selection-mode button.titlebutton:not(.appmenu).close:hover, button.titlebutton:not(.appmenu).close:hover {
      background-image: -gtk-gradient(radial, center center, 0, center center, 0.35714, to(#E95420), to(transparent));
      background-image: -gtk-gradient(radial, center center, 0, center center, 0.35714, to(#eb6637), to(transparent)); }
    headerbar button.titlebutton:not(.appmenu).close:active,
    .titlebar button.titlebutton:not(.appmenu).close:active,
    headerbar.selection-mode button.titlebutton:not(.appmenu).close:active, button.titlebutton:not(.appmenu).close:active {
      background-image: -gtk-gradient(radial, center center, 0, center center, 0.35714, to(#E95420), to(transparent));
      background-image: -gtk-gradient(radial, center center, 0, center center, 0.35714, to(#da4816), to(transparent)); }
    headerbar button.titlebutton:not(.appmenu).close:backdrop,
    .titlebar button.titlebutton:not(.appmenu).close:backdrop,
    headerbar.selection-mode button.titlebutton:not(.appmenu).close:backdrop, button.titlebutton:not(.appmenu).close:backdrop {
      background-image: -gtk-gradient(radial, center center, 0, center center, 0.35714, to(#636363), to(transparent)); }
      headerbar button.titlebutton:not(.appmenu).close:backdrop:hover,
      .titlebar button.titlebutton:not(.appmenu).close:backdrop:hover,
      headerbar.selection-mode button.titlebutton:not(.appmenu).close:backdrop:hover, button.titlebutton:not(.appmenu).close:backdrop:hover {
        background-image: -gtk-gradient(radial, center center, 0, center center, 0.35714, to(#707070), to(transparent)); }

これが私のカスタマイズされたファイルの内容です/usr/share/themes/Yaru/gtk-3.20/gtk.css

@import url("resource:///com/ubuntu/themes/Yaru/3.20/gtk.css");

      headerbar button.titlebutton:not(.appmenu).close,
      .titlebar button.titlebutton:not(.appmenu).close,
      headerbar.selection-mode button.titlebutton:not(.appmenu).close, button.titlebutton:not(.appmenu).close {
        color: red;
        background-image: -gtk-gradient(radial, center center, 0, center center, 0.35714, to(green), to(transparent)); }
        headerbar button.titlebutton:not(.appmenu).close:hover,
        .titlebar button.titlebutton:not(.appmenu).close:hover,
        headerbar.selection-mode button.titlebutton:not(.appmenu).close:hover, button.titlebutton:not(.appmenu).close:hover {
          background-image: -gtk-gradient(radial, center center, 0, center center, 0.35714, to(gold), to(transparent));
          background-image: -gtk-gradient(radial, center center, 0, center center, 0.35714, to(cyan, to(transparent)); }
        headerbar button.titlebutton:not(.appmenu).close:active,
        .titlebar button.titlebutton:not(.appmenu).close:active,
        headerbar.selection-mode button.titlebutton:not(.appmenu).close:active, button.titlebutton:not(.appmenu).close:active {
          background-image: -gtk-gradient(radial, center center, 0, center center, 0.35714, to(magenta), to(transparent));
          background-image: -gtk-gradient(radial, center center, 0, center center, 0.35714, to(orange), to(transparent)); }
        headerbar button.titlebutton:not(.appmenu).close:backdrop,
        .titlebar button.titlebutton:not(.appmenu).close:backdrop,
        headerbar.selection-mode button.titlebutton:not(.appmenu).close:backdrop, button.titlebutton:not(.appmenu).close:backdrop {
          background-image: -gtk-gradient(radial, center center, 0, center center, 0.35714, to(blue), to(transparent)); }
          headerbar button.titlebutton:not(.appmenu).close:backdrop:hover,
          .titlebar button.titlebutton:not(.appmenu).close:backdrop:hover,
          headerbar.selection-mode button.titlebutton:not(.appmenu).close:backdrop:hover, button.titlebutton:not(.appmenu).close:backdrop:hover {
            background-image: -gtk-gradient(radial, center center, 0, center center, 0.35714, to(yellow), to(transparent)); }

ここに画像の説明を入力してください

ここに画像の説明を入力してください

ここに画像の説明を入力してください


オプションでアイコンを変更できます。下の画像を見れば一目瞭然です。

ここに画像の説明を入力してください

答え2

style に記述することで、閉じるボタンのスタイルを変更できます~/.config/gtk-3.0/gtk.css

button.titlebutton.close:backdrop {
  background-color: transparent;
}

button.titlebutton.close {
  background-color: @theme_selected_bg_color;
}

参考文献:

関連情報