syntaxhighlighter how to change the color of comment - syntaxhighlighter

I am new to using syntaxhighlighter. I am using there latest version 3.0.83. Can some one help how to customize the color of comments, header, etc ?
I am using < pre class="brush: c"> for coding style.

The easiest solution would be to override the CSS rules for comments, but they're marked as !important so you have to do a little extra work.
Open your shBrushCpp.js file. Down towards the bottom there's a set of regular expression rules paired with a css property. Those values correspond to class names in shThemeDefault.css (or whatever theme you're using).
Copy your theme file to something like shThemeCustom.css or whatever you want. Include this file on your page instead of the original theme. From here, you can change whatever you want. Just reference the CSS rules from the brush file against your custom theme to know what needs to be changed.

In case you don't have full control over the .css or .js files, as is my case (since I followed these instructions here and am using Alex Gorbatchev's hosted files instead), there is still a way to override the !important parameter.
You can customize any of the settings shown here (http://agorbatchev.typepad.com/pub/sh/3_0_83/styles/shThemeDefault.css), for example, as follows:
With the default theme, this HTML...
<pre class="brush:cpp" title="test code">
int myFunc()
{
//do something
return 1;
}
</pre>
...yields this result:
Looking here (http://agorbatchev.typepad.com/pub/sh/3_0_83/styles/shThemeDefault.css), I can see the parameters I am currently using. For example, it contains:
.syntaxhighlighter {
background-color: white !important;
}
.syntaxhighlighter .line.alt1 {
background-color: white !important;
}
.syntaxhighlighter .line.alt2 {
background-color: white !important;
}
...
.syntaxhighlighter .comments, .syntaxhighlighter .comments a {
color: #008200 !important;
}
In order from top to bottom, as shown just above, my header background color is white and my alternating code lines 1 and 2 are both white. Comments are green (#008200). Let's change all of that. Add the following code to your blogger template, at the very end of your header, just above </head>:
<style type='text/css'>
.syntaxhighlighter {
max-height: 550px;
background-color: #ff0000 !important;
overflow-y: auto !important;
overflow-x: auto !important;
}
.syntaxhighlighter .line.alt1 {
background-color: #99ff99 !important;
}
.syntaxhighlighter .line.alt2 {
background-color: #99ff99 !important;
}
.syntaxhighlighter .comments, .syntaxhighlighter .comments a {
color: #000082 !important;
font-weight: bold !important;
}
</style>
Now, I have set my max-heightto 550 pixels (make a really long code block and you'll see it constrained to this height now, with a vertical slider to see it all), my header background color is red (#ff0000), my code background color (both alternating lines) is light green (#99ff99), and my comments are blue (#000082) and bold. Follow this format to customize anything you see in your .css theme file--example, for me, here: http://agorbatchev.typepad.com/pub/sh/3_0_83/styles/shThemeDefault.css.
Here is my final result--very different from the default look above:
Note that the font-weight parameter I set is simply a CSS styling you can apply. Many other options exist. See here: http://www.w3schools.com/cssref/pr_font_weight.asp.

Related

How to edit the Simplex Theme for a Quarto Website?

I want to create a Website with Quarto, using the Bootswach theme "Simplex".
The theme is simple but elegant. I like the mix of white, black gray and red colors.
However, I come across three challenges:
(1) Including a logo is pretty easy by adding "logo: "/img/logo.png" in the _quarto.yml file. However, the logo is displayed in the header very small. How can I increase the size of the logo in the header?
(2) The title of the Website is printed in "black" color as one can see here in the Simplex Theme template (it is the third navigation bar in white). How can I change the color of the title to the red of the link color?
(3) Finally, the color of the links in the body is red. But the color of the links in the menu is gray. I want to display the links as well as the active menu-item in the navbar in red (i.e., the link color). How can I change that?
I know, that I must change the .scss and/or .css files or add another .scss and/or .css file to the _quarto.yml . But I did not manage to solve this issue.
Can anyone give me some hints how to solve these problems?
Is this what you are looking for?
Concerning Q1 & Q2 (color):
styles.css
.navbar-dark .navbar-brand {
background: url('https://upload.wikimedia.org/wikipedia/commons/e/ef/Stack_Overflow_icon.svg');
background-size: contain;
padding-right: 5px !important;
padding-left: 75px !important;
background-repeat: no-repeat;
color: #d9230f;
}
Concerning Q3:
simplex-theme.scss
/*-- scss:defaults --*/
$navbar-hl: #d9230f;
_quarto.yml
project:
type: website
website:
title: "TEST Website"
navbar:
left:
- href: index.qmd
text: Home
- about.qmd
format:
html:
theme: [simplex, simplex-theme.scss]
css: styles.css
Result:
For Q1, try this in the style.css file:
.navbar-brand {
max-height: 90px;
margin: -8px;
}
.navbar-logo {
max-height: 90px;
max-width: 90px;
height: 89px;
width: 89px;
margin-top: -9px;
}
Just play around with values.
For Q2, the simplest approach might be to edit this in the _quarto.yml:
website:
title: "Website Title"
navbar:
background: "#______"
foreground: "#______"
And I don't know about Q3.
Setting link color is easy in the _quarto.yml under the section
format:
html:
theme:
linkcolor: "whatevs"
but I think you already knew that.

Remove iOS input shadow

On iOS (Safari 5) I have to following for input element (top inner shadow):
I want to remove top shadow, bug -webkit-appearance doesn't save.
Current style is:
input {
border-radius: 15px;
border: 1px dashed #BBB;
padding: 10px;
line-height: 20px;
text-align: center;
background: transparent;
outline: none;
-webkit-appearance: none;
-moz-appearance: none;
}
You'll need to use -webkit-appearance: none; to override the default IOS styles. However, selecting just the input tag in CSS will not override the default IOS styles, because IOS adds it's styles by using an attribute selector input[type=text]. Therefore your CSS will need to use an attribute selector to override the default IOS CSS styles that have been pre-set.
Try this:
input[type=text] {
/* Remove First */
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
/* Then Style */
border-radius: 15px;
border: 1px dashed #BBB;
padding: 10px;
line-height: 20px;
text-align: center;
background: transparent;
outline: none;
}
Helpful Links:
You can learn more about appearance here:
http://css-tricks.com/almanac/properties/a/appearance/
If you'd like to learn more about CSS attribute selectors, you can find a very informative article here:
http://css-tricks.com/attribute-selectors/
background-clip: padding-box;
Seems to remove the shadows as well.
As #davidpauljunior mentioned; be careful setting -webkit-appearance on a general input selector.
webkit will remove all properties
-webkit-appearance: none;
Try using the property box-shadow to remove the shadow on your input element
box-shadow: none !important;
Whilst the accepted answer is a good start, as others have pointed out, it only works for inputs whose type is "text". There are a myriad of other input types which also render as text boxes on iOS, and so we need to expand this rule to take into account these other types.
Here's the CSS I'm using to rid input text fields and textareas of the inner shadow, whilst preserving the default styling for buttons, checkboxes, range sliders, date/time dropdowns and radio buttons, all of which are authored using the humble <input> tag too.
textarea,
input:matches(
[type="email"],
[type="number"],
[type="password"],
[type="search"],
[type="tel"],
[type="text"],
[type="url"]
) {
-webkit-appearance: none;
}
I tried to come up with a solution that a.) works and b.) I am able to understand why it works.
I do know that the shadow for inputs (and the rounded border for input[type="search"]) comes from a background-image.
So obviously setting background-image: none was my first attempt, but this does not seem work.
Setting background-image: url() works, but i am still concerned about having a empty url(). Altough it currently is just a bad feeling.
background-clip: padding-box; seems to do the job as well, but even after reading the "background-clip" docs I don't get why this completly removes the background.
My favorite solution:
background-image: linear-gradient(transparent, transparent);
This is valid css and I do understand how it works.
This works better for me. Plus it means I don't have to apply it to every different type of input (i.e. text, tel, email, etc).
* {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}

Use CSS Class in HighCharts

Instead of specifying CSS styles with highchart options such as (fontWeight, fontColor, etc), is it possible to use CSS classes for styling the different elements of a chart?
In many cases (tooltip,labels) you can set useHTML as true, and then use CSS styles without !important or use formatter to define your own elements with CSS styles.
Example http://api.highcharts.com/highcharts#tooltip.useHTML
Yes, you have to use !Important because it's the only way to override inline style.
Your chart is render on some content which you have to pass it's id on chart.rendertTooption.
So you can match the elements by your chart container, like.
#container text {
font-size: 14px !Important;
}
Demo
Your highcharts chart is an SVG in your html.
You need to inspect the SVG source code to know the names of the classes and then you can use them in your CSS.
You need to add !important because some default styles already exist in the SVG.
For example
You can use
text {
fill:red !important;
font-family: "Arial" !important;
font-size : 12px !important;
}
To define default font color, family and style
or
.highcharts-yaxis-labels text
{
(some css )
}
to define the y-axis labels style
You can use css class name in highcharts 'chart' option but these changes will not reflect on exported chart. For example:
chart{
type: 'line',
className: 'someCss'
}
css:
.someCss{
border-top-left-radius: 25px;
font-weight: bold;
font-style: italic;
}

Hilighted links with text-shadow erase bars in selection on hover

When I mouse over links that are highlighted, it seems it creates a sort of bar in the selection. Very weird. It's lower down than underlines would be so I don't think it's related to that.
I have moused over "consectetur" and "sapein interdum…". The bars stay there even after the mouse leaves. If there is on link on one extremity of a line and another on the other, hovering both makes the bar join and fill the whole line.
Two things make this problem go away:
Removing text shadows
Not changing the link colour on hover
Relevant CSS:
#content {
color: #444;
font-family: 'Armata', sans-serif;
text-shadow: 1px 1px 0 #fafafa;
line-height: 50px; // make it way too big just to make sure you can see it
}
a { text-decoration: none; color: #069; }
a:hover { color: #08c; }
Happens on Safari and Chrome (webkit), not sure about others.

How to Make a Transparent Background for jQuery UI Accordion or Tabs?

Does anyone know how to render the background of the jquery ui tabs or accordion controls as transparent?
Add this to your css file:
.ui-accordion-content-active
{
padding: 0 !important;
border-style: none;
background-color: transparent;
background-image: none;
}
You can adjust the padding to whatever fits your needs.
Find the correct line in the css and change the background attribute to transparent.
In CSS you can make use of the rgba(int, int, int, float) function to define a color. So, I guess you want something like this:
background-color: rgba(255, 255, 255, 0.3);
Note that the RGB components are in the range [0, 255] (which is one byte) and the alpha channel is in the range [0,1].
in the jqueryui css file's 'Component containers' section, you can find the .ui-widget-content class and set
background: transparent;
Note: If you are using overlays, they might get messed up~

Resources