• Resolved Gregosz

    (@gregosz)


    Hi!
    I love your plugin and I am going to use it in my new blog about WordPress.
    
    Just one question:
    
    I would like to change background color of active line and selected text.
    
    I have dnotice that for active line class is codemirror-activeline.
    
    But the following css code does not work:
    
    .codemirror-activeline {
      background-color: #1000ff !important;
    }
    
    About selected text I have no idea at all.
    
    What shoud i do?
    
    warm regards,
    Grzegorz
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Vicky Agravat

    (@vickyagravat)

    Hello @gregosz

    You can do it using

    
    .CodeMirror-activeline-background {
        background: rgba(16, 0, 255, 1) !important;
    }
    

    Thank you.

    Thread Starter Gregosz

    (@gregosz)

    Hi!

    Thank you very much!
    It works very well. Just one modification:
    Instead of background I put background-color
    ??

    What about background color of code text selected by cursor?

    Grzegorz

    Plugin Author Vicky Agravat

    (@vickyagravat)

    Of Course you can use background-color instead of background.

    and now talk about selected text. to do so, we need pseudo selector
    It may be work on some browser, or not.

    Try your luck with following css snippet.

    .CodeMirror-line::selection,
    .CodeMirror-line>span::selection,
    .CodeMirror-line>span>span::selection {
        background:  rgba(16, 0, 255, 1) !important;
    }
    Thread Starter Gregosz

    (@gregosz)

    Hi!

    I found that for code sellection the following snippet works:

    div.CodeMirror-selected { background: green !important; }

    thank you! ??
    Grzegorz

    Plugin Author Vicky Agravat

    (@vickyagravat)

    Hi @gregosz

    Good to know that you find suitable class for give style.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Background color of active line and selected text’ is closed to new replies.