Text Sprite styling - css

Is there some way to define a text sprite with some more style options then just size and font as shown in the example?
{
type: "text",
text: "Hello, Sprite!",
fill: "green",
font: "18px monospace"
}
Specifically, I want to make it bold or underlined.
I tried a style config like this:
style: {
'text-decoration': 'underline'
}
I also tried setting it in the font config like this:
font: "underline 18px monospace"
Neither worked.
This sentence from the Ext.draw.Sprite#font config in the docs sounded promising but it is pretty cryptic:
Uses the same syntax as the CSS font parameter
I've been googling around for the CSS font parameter and haven't found much of use. Maybe if someone knows what that means they can shed some light on this.

The font css attribute will let you specify bold and italics, but underline is set using the text-decoration attribute. You'll need to use a style config:
{
type: "text",
text: "Hello, Sprite!",
fill: "green",
font: "bold 18px monospace",
style: {
textDecoration: "underline"
}
}
Working demo: http://jsfiddle.net/gilly3/WSQv9/.
Tested in Chrome and IE9. Firefox doesn't yet support underline in SVG.
For reference, here is the font parameter definition:
MSDN
MDN

I've never used extjs, but it looks like SVG to me. Unfortunately Firefox doesn't support text-decoration attribute on svg elements, so perhaps you are testing in Firefox but in Chrome it might be displaying fine with your style attribute.
The workaround for this would be drawing the underline manually with a line element. It is not difficult with javascript but I would have no idea of how to accomplish this the extjs way.

Related

Vaadin button css background isn't working

I am using Vaadin version 14.7.3.
I have a button
Button reminder_settings = new Button("Reminder settings", e->menuClick("Reminder settings"));
reminder_settings.setClassName("headliner");
and I have my css
#CssImport("./mainstyle.css")
The file has this
.headline {
font-weight: bold;
}
.headliner {
font-weight: bold;
}
Now, if I set the className to headline (without the r) my button is bold. But not when it has the className = headliner.
I also cannot add a background-color or anything similar.
What am I doing wrong? Is there a cheat-sheet for styling components?
Now, if I set the className to headline (without the r) my button is bold. But not when it has the className = headliner.
That sounds like there is something wrong with your CSS, some incorrect character perhaps, or some other typing error. Nothing else should make a difference between using a different class name.
I also cannot add a background-color or anything similar.
Can you show what you tried to do? I assume you used the same classname(s) as before, and tried adding background-color there. That should work as well, as long as the CSS is in the same style scope as the button your are styling. Note, that some buttons might be inside shadow roots, and therefore global CSS selectors won't match them.

Trix Editor Rails - Customizing

I am using a trix editor such as <%= f.trix_editor :body, class: 'trix-content form-control', rows: 15 %>
Currently the buttons are black and obviously translated english (as well as the alt texts).
How am I supposed to change the colors of the buttons? Everything Ive tried didn't seem to work.
Is there any way to provide german translations? I need my full application to be completely german.
Best regards
You can change the background color of the buttons with css.
trix-toolbar .trix-button-group button {
background-color: green;
}
The button icons are images, so you would have to replace them in order to customize icon color, etc. For example, to remove the bold button icon with css:
trix-toolbar .trix-button-group button.trix-button--icon-bold::before {
background-image: none;
}
You can change the button tooltips (for translation or otherwise) with javascript by referring to the data-trix-attribute for the button you would like to change. For example, to change the bold button where the data-trix-attribute is set to "bold" (due to browser inconsistencies, it is best to set both the Trix.config.lang and the element title attribute):
Trix.config.lang.bold = 'Really Bold';
document.querySelector('button[data-trix-attribute="bold"]').setAttribute('title', 'Really Bold');
Following snippet illustrates the various changes above.
// hover over the now blank bold button in the toolbar to see the tooltip
Trix.config.lang.bold = 'Really Bold';
document.querySelector('button[data-trix-attribute="bold"]').setAttribute('title', 'Really Bold');
trix-toolbar .trix-button-group button {
background-color: green;
}
trix-toolbar .trix-button-group button.trix-button--icon-bold::before {
background-image: none;
}
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/trix/1.1.1/trix.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/trix/1.1.1/trix.js"></script>
<trix-editor></trix-editor>
I know that I'm really late to the conversation but I was looking at doing this very issue this morning. There are solutions about replacing the icons that Trix utilizes (Material Design Icons by Google). Someone has a really neat idea replacing them with FontAwesome icons.
These are SVG images so color cannot be changed. For my particular situation I used a webkit filter to change the color from black to gray:
trix-toolbar .trix-button--icon {
-webkit-filter: invert(50%);
}
This should go in the application.scss. For a reason I have not tracked down yet, putting this in the actiontext.scss file is not working, even though it's being imported into the application.scss.

Replacing font icons with SVG icon - Remove inline styles

Recently I decided to switch to SVG icons from font icons. I used Illustrator to draw my SVGs and I exported the artboards (containing an individual icon) with the following settings:
Styling: Inline Style
Font: SVG
Images: Embed
Object IDs: Layer Names
Decimal: 2
I used the Icomoon app to generate the SVG icons. The problem though is, all the SVGs have a fill, stroke or style property inline everywhere. I can’t update the icon color with CSS while those styles are there in the SVG.
Am I missing something? Is there an option in Illustrator to save the SVG’s without the fill / stroke / styles properties? Or do I have to use something like Remove SVG Properties to remove the properties?
If Remove SVG Properties is the way to go, can someone tell me how to use it in my Angular CLI project? I’m very new to this.
Yes, you can.
Just select the svg in CSS then apply:
selector {
fill: red;
stroke: blue;
/* etc */
}
It seems to work fine for me.
Optionally, add !important if needed.
Another thing you can do to update inline CSS is by jQuery, using .css() method.
One way to use free icons from that place is (link):
.lnr-home {
color: red;
font-size: 40px;
/* To get crisp results, use sizes that are
a multiple of 20; because Linearicons was
designed on a 20 by 20 grid. */
}
body {
font-size: 40px;
font-family: sans-serif;
color: #red;
}
<!-- Add the following <link> to the <head> of your HTML. -->
<link rel="stylesheet" href="https://cdn.linearicons.com/free/1.0.0/icon-font.min.css">
<!-- To insert the icon: -->
<span class="lnr lnr-home"></span> lnr-home
<!--
Cheat Sheet:
https://linearicons.com/free#cheatsheet
-->
You can use online tool
this is automatically convert inline style.
use this android developer
http://inloop.github.io/svg2android/

RST: how to decrease font size in code blocks?

I would like to include a code block in a presentation I am preparing with Restructured Text. But the font used in the code block is huge and it can not fit inside resulting code box:
How can I reduce the font size used in code blocks?
Set the fontSize property of the code style in your style file.
e.g.
code:
parent: literal
fontSize: 10
Some of the builtin themes (alabaster) accept usage of custom.css.
Create _static/custom.css and add the following to adjust the code-block font-size:
_static/custom.css:
.highlight { background: #f8f8f8; font-size: x-small;}
You need a layout.html in a dir mysources/_templates and in your mysources/conf.py you need a declaration templates_path = ['_templates'].
In layout.html add a declaration
div.highlight {
font-size : 0.8em; /* or another value you prefer */
}
This works for me because I use the html_theme sphinxdoc. Maybe in other themes the declarations differ. If so you must find out the declaration by a html debugger like Inspektor in Firefox or Developer Tools in Chrome or DOM Explorer in IE.

Tooltip in Bootstrap 3 has unwanted CSS effects in Firefox

Please see my live site http://mozzor.com and hover over the circle icons at the top. Notice two effects that occur only in Firefox (I'm using FF23):
1) There is a blue underline added to the text of the tooltip
2) The text renders upon hovering, then after a moment, seems to blur itself.
I'm having trouble debugging this with Firebug...I can't find a css element that corresponds to either of these effects.
Just in case, here is some relevant code for how I style the tooltips:
// Variable currentSelect corresponds to hex color value
// selected in the jQuery widget seen at the top left side of the page
$('#notebookIcon,#pencilIcon,#headphoneIcon').tooltip().on("mouseover", function () {
var tooltip = $(this).next(".tooltip");
//Box
tooltip.find(".tooltip-inner").css({
backgroundColor: "#fff",
color: currentSelect,
borderColor: currentSelect,
borderWidth: "1px",
borderStyle: "solid"
});
//Arrow
tooltip.find(".tooltip-arrow").css({
//borderTopColor: currentSelect,
//borderLeftColor: currentSelect,
//borderRightColor: currentSelect,
borderBottomColor: currentSelect
});
});
EDIT: Second issue seems to deal with font aliasing slowly in Firefox. Issue still persists after trying several different fonts. For more information, see below:
Github issue: https://github.com/twbs/bootstrap/issues/10218
Bugzilla issue: https://bugzilla.mozilla.org/show_bug.cgi?id=909814
Your first problem is the underline, which is dictated by the CSS text-decoration property. I'm not exactly sure why it's happening on Firefox (Chrome seems to have it correct, because text-decoration for your menu items is set to none). Here's a quick fix, but I'll see if I can find the cause.
#iconrow a {
text-decoration: none;
}
About the second question: I don't understand why you can't do this with CSS.

Resources