【问题标题】:How do I change the mouse cursor in Atom?如何在 Atom 中更改鼠标光标?
【发布时间】:2017-05-24 19:47:28
【问题描述】:

我在 Mac Sierra 上使用 Atom 1.15.0。我想将鼠标光标从细条更改为更明显的东西,例如块。我打开了我的 styles.less 文件并添加了

atom-text-editor .cursor {
  transition:opacity 0.5s linear;
}

然后重新启动 Atom,但我的鼠标光标还是像以前一样出现(一条细线)。怎么改?

编辑:包括我的styles.less文件

/*
 * Your Stylesheet
 *
 * This stylesheet is loaded when Atom starts up and is reloaded automatically
 * when it is changed and saved.
 *
 * Add your own CSS or Less to fully customize Atom.
 * If you are unfamiliar with Less, you can read more about it here:
 * http://lesscss.org
 */


/*
 * Examples
 * (To see them, uncomment and save)
 */

// style the background color of the tree view
.tree-view {
  // background-color: whitesmoke;
}

// style the background and foreground colors on the atom-text-editor-element itself
atom-text-editor {
  // color: white;
  // background-color: hsl(180, 24%, 12%);
}

// style UI elements inside atom-text-editor
atom-text-editor .cursor {
  transition:opacity 0.5s linear;
}

.editor .cursor {
   position: absolute;
   border: 1px solid;
   background-color: rgba(244,100,122,0.6);
}

atom-text-editor .editor-contents--private { cursor: default; }

【问题讨论】:

    标签: cursor styles atom-editor


    【解决方案1】:

    我会引导你到这个包:

    https://atom.io/packages/block-cursor

    还有:Changing cursor style of atom editor

    更新:

    这些属性应该适用于鼠标光标,就像它们适用于文本光标一样。只要引导得当。

    尝试将其添加到样式表中:

    atom-text-editor .editor-contents--private { cursor: default; position: absolute; border: 1px solid; background-color: rgba(244,100,122,0.6); }

    【讨论】:

    • 在 Atom 上安装包的快捷方式是什么?
    • 我相信是ctrl + , 会调出设置,然后您可以选择左侧的packages 选项卡并从那里搜索包。您也可以尝试按ctrl + shift + P,然后会出现下拉菜单,然后您可以输入关键字:install packages,您应该会看到安装软件包的选项。 :D
    • 您也可以转到file menu--> settings 并选择包标签
    • 如果可行,请随时将此答案标记为解决方案
    • 正如网友指出的,你指的是文本光标,对吧?我的问题涉及鼠标光标。
    【解决方案2】:

    将它插入你的styles.less

    atom-text-editor .editor-contents--private { cursor: default; }
    

    【讨论】:

    • 那没有做到。也许我没有把线条放在你想要的地方?我在我的问题中包含了我的整个 styles.less 文件。
    • 我知道 1.15 和 1.17 版本之间发生了一些变化,这可能会导致这种情况。尝试打开开发工具:Menu->View->Developer->Toggle developer tools,然后检查编辑器中的任何一行。现在尝试检查父元素,直到找到 cursor 属性,这将为您提供正确的选择器以放置在您的 styles.less 中
    • 我按照你说的做了,但我不知道如何检查生成鼠标光标的样式。
    • 而不是检查父元素:只需将工具切换到右侧窗格中的“计算样式”选项卡即可。在那里寻找光标,您将获得指向它们定义位置的指针。使用其中的选择器,您的 styles.less 将覆盖它。
    • 我不明白您最后的评论——“只需将工具切换到“计算样式”选项卡”。我打开的所有选项卡都是我打开的文件。另外,我的菜单栏中没有看到“工具”菜单。
    【解决方案3】:
        atom-text-editor {
      cursor: url(/home/thedude/Pictures/ico/octocat_mini.png), auto;
        }
    

    Atom with Octocat mouse pointer

    我可以确认这一行允许更改鼠标光标,但仅限于在编辑器或搜索框等中。打字光标是结尾 } 之后的紫色东西。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-05-27
      • 1970-01-01
      • 2010-11-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多