imathis / octopress

Octopress is an obsessively designed framework for Jekyll blogging. It’s easy to configure and easy to deploy. Sweet huh?
http://github.com/imathis/octopress
9.32k stars 2.62k forks source link

Custom selection color in code blocks #1474

Open paulidealiste opened 10 years ago

paulidealiste commented 10 years ago

Hello,

I`m new to Octopress and this is my blog creative_morphometrics. The problem persists in the code selection color inside code boxes. As you can see, when trying to select text from within boxes it seems that no selection is possible. That is because color selection is white and the background is also white. How to change this?

I tried tweaking the custom solarized code, all values, changing from light to dark theme, and nothing worked for me. Any ideas?

jimmybrancaccio commented 10 years ago

I believe the issue is here:

.gist .highlight *::-moz-selection, figure.code .highlight *::-moz-selection {
    background: #fff;
    color: inherit;
    text-shadow: #fff 0 1px
}

.gist .highlight *::-webkit-selection, figure.code .highlight *::-webkit-selection {
    background: #fff;
    color: inherit;
    text-shadow: #fff 0 1px
}

.gist .highlight *::selection, figure.code .highlight *::selection {
    background: #fff;
    color: inherit;
    text-shadow: #fff 0 1px
}

Have a poke through your themes CSS files.

paulidealiste commented 10 years ago

Ok, custom selection colors for code blocks could be changed directly in the _utilities.scss and changing this line

@mixin selection($bg, $color: inherit, $text-shadow: none){
  * {
    &::-moz-selection { background: #FFAD33; color: $color; text-shadow: $text-shadow; }
    &::-webkit-selection { background: $bg; color: $color; text-shadow: $text-shadow; }
    &::selection { background: $bg; color: $color; text-shadow: $text-shadow; }
  }
}

so moz-selection background could be set in any color you like...the default is the bg color.

Thanks Jimmy.

paulidealiste commented 10 years ago

Unfortunately, the solution works only locally and after I rake deploy, everything is ok, except that the selection color inside the code blocks is white again. Take a look creativemorphometrics.