Change atom-text-editor pane scrollbar colours

不羁岁月 提交于 2019-12-13 01:28:45

问题


I have just switched to atom from sublime text and tried to apply my usual themes. Unluckily the theme that I use (spacegray eighties sublime port) does not incorporate the correct theme for the scrollbars. I managed to fix the look of the scrollbars in the tree-view panel. However, I cannot apply the same to the atom-text-editor for some reason. My styles.less is the following:

atom-text-editor {
  // Apply same scrollbar color fix.
}

// Scrollbar color fix for SpaceGray
::-webkit-scrollbar {
  background-color: #262626;

  &-track {}

  &-thumb {
    background-color: #404040;

    &:window-inactive {
      background-color: rgb(116, 115, 105);
    }
  }

  &-corner {
    background-color: #262626;
  }
}

And here a preview of my problem:

I tried putting the same ::-webkit-scrollbar CSS into the atom-text-editor with !important statements, but with no luck.


回答1:


You were close, you have to wrap your styles inside .scrollbars-visible-always:

.scrollbars-visible-always {
  ::-webkit-scrollbar {
    background-color: #262626;    

    &-track {}    

    &-thumb {
      background-color: #404040;    

      &:window-inactive {
        background-color: rgb(116, 115, 105);
      }
    }    

    &-corner {
      background-color: #262626;
    }
  }
}



回答2:


In Atom 1.18.0 the following works for me for all scrollbars:

::-webkit-scrollbar {
    width: 50px;
    height: 18px;

    &-track {
         border: 0px;
         border-radius: 0px;
         background-color: transparent !important;
     }

     &-thumb {
         background-color: rgba(213, 213, 213, 0.4) !important;
         border: 0px;
         border-radius: 0px;
     }
}

// for new opened files
.vertical-scrollbar {
    width: 50px !important;
}



回答3:


Actually this does not seem to work anymore for current versions of Atom. With the following code I was able to style both the scrollbar in the tree view and in the editor windows:

.tree-view-resizer, atom-text-editor::shadow  {
  ::-webkit-scrollbar {
    background-color: #262626;

    &-track {}

    &-thumb {
      background-color: #404040;

      &:window-inactive {
        background-color: rgb(116, 115, 105);
      }
    }

    &-corner {
      background-color: #262626;
    }
  }
}


来源:https://stackoverflow.com/questions/34225056/change-atom-text-editor-pane-scrollbar-colours

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!