LouisBarranqueiro / hexo-theme-tranquilpeak

:lipstick: A gorgeous responsive theme for Hexo blog framework
https://louisbarranqueiro.github.io/hexo-theme-tranquilpeak/
GNU General Public License v3.0
1.86k stars 484 forks source link

Modify inline code color in `_base.scss` not working #698

Closed secsilm closed 2 years ago

secsilm commented 2 years ago

First of all, Thanks for your great theme!

Description

I tried to modify inline code styles and successfully modified some of them. I followed the instructions in https://github.com/LouisBarranqueiro/hexo-theme-tranquilpeak/issues/10#issuecomment-102610892.

But I cannot make it through modifying tranquilpeak\source\_css\base\_base.scss as follows:

// inline code
code {
    font-size:        85%;  // map-get($font-size, medium)
    // display:          inline-block;
    font-family:      map-get($font-families, 'code');
    font-weight:      400;
    background-color: rgba(175,184,193,0.2);   // <-- THIS is not working
    padding:          0.2em 0.4em;
    margin: 0;
    border-radius: 6px;
}

Chrome dev tools:

image

You can see it's crossed out. Also you can view the screenshot page here.

Expected behavior

Change the inline code background color to rgba(175,184,193,0.2):

image

Steps to reproduce the bug

Environment

Additional information

LouisBarranqueiro commented 2 years ago

👋 @secsilm, it works, it's just that this property is overridden by another one:

Screen Shot 2022-01-12 at 9 35 19 PM
secsilm commented 2 years ago

@LouisBarranqueiro Then how do I keep it from being overridden?

LouisBarranqueiro commented 2 years ago

I can't really tell because you modified the code of the theme. You need to search in the different files where the property background-color:#f7f8f8; is set and remove it.

secsilm commented 2 years ago

OK, I finally get it worked. Here are the steps:

  1. Modifying the inline code color as above.
  2. Comment out background in _variables.scss as following:
    // Highlight code
    $highlight: (
        // 'background':  #f7f8f8,  // <-- COMMENT OUT HERE
        'font-size':   1.4rem,
        'border':      1px solid,
        'line-height': 1.3em
    );
  3. The above code will result in losing backround color of the pre code, so we have to specify the background color in _code.scss:

    // Reset for tag `pre` and  for class `.gutter`, `.code`, `.tag`
        pre,
        .gutter,
        .code,
        .tag {
            background-color: #f7f8f8;  // <-- MODIFY COLOR HERE
            font-family:      #{map-get($font-families, 'highlight')};
            border:           none;
            padding:          0;
            margin:           0;
            // To override cursor attribute of `.tag` components
            cursor:           text;
        }
  4. npm run prod