How to increase PNotify font size? - css

What's the best way to increase font size of PNotify notifications ?
new PNotify({
title: "Title",
text: "Some information more.",
type: "notice"
})
From here

I don't see any built-in way to do that. You should add addclass: "someClass" to the initialization and then change the font size by writing .someClass .ui-pnotify-text { font-size: 1.25em } for the description text and .someClass .ui-pnotify-title { font-size: 1.25em } for the title into your custom CSS file.

Related

Matching a font style exactly with QML

I have a QML app that's using a font family that has 5 weights—Light/Regular/Medium/Bold/Black—and 3 styles: Normal, Italic, and Condensed.
When I load both a 'normal' and 'condensed' style of the same weight they share the same family name; whichever style was loaded first is what is used:
FontLoader { source:"qrc:/fonts/DINPro-CondRegular.otf"; id:cond }
FontLoader { source:"qrc:/fonts/DINPro-Regular.otf"; id:norm }
Timer { running:true; onTriggered:console.log(id:norm.name==cond.name) } // outputs `true`
// This ends up using the condensed flavor
Text { text:'hi mom'; font { family:'DINPro' } }
Is there some way to tell a Text object to use a specific font file or FontLoader instance? There's an italic property for italic style, but no property for the 'condensed' flavor.
How can I use both normal and condensed styles of the font in the same document, and specify which to use for different Text?
I've found that for this particular font I can use the styleName property to control the various flavors. I just kept trying various style strings until I found ones that worked.
FontLoader { source:"qrc:/fonts/DINPro-Regular.otf" }
FontLoader { source:"qrc:/fonts/DINPro-CondRegular.otf" }
FontLoader { source:"qrc:/fonts/DINPro-CondMedium.otf" }
Text { text:'norm'; font { family:'DINPro'; styleName:'Regular' } }
Text { text:'bold'; font { family:'DINPro'; weight:Font.Bold; styleName:'Regular' } }
Text { text:'blak'; font { family:'DINPro'; weight:Font.Black; styleName:'Regular' } }
Text { text:'cond norm'; font { family:'DINPro'; styleName:'CondRegular' } }
Text { text:'cond bold'; font { family:'DINPro'; styleName:'CondBold' } }
Text { text:'cond blak'; font { family:'DINPro'; styleName:'CondBlack' } }
It feels like it's held together with tape and string, but it's working. If someone has a more robust way to handle this—especially to know exactly what strings will work for the styleName—I'll happily accept that answer instead of this one.

Customize Google Charts with CSS

I want to customize the classes in Google Charts.
As far as I'm concerned, there are two options that I've stumbled upon. The first option is:
Just inspect the elements in the browser, to see what the name of the classes is, then just give them new rules in the css file. In some cases I've to set !important; to override the rule. This option seems very "ugly", because forcing the class to have an !important; state is just ugly.
.charts-menu-button,
.charts-menu-button-inner-box {
width: 200px;
line-height: 55px;
border: 0 !important;
padding: 0 !important;
}
This is my second option which I'm pretty confused over. As I read the Google Chart docs, they suggest to call the "cssClass", like this:
options: {
ui: {
cssClass: {}
}
}
What I don't understand is when I'm going with the second option, absolute nothing happens to the class I want to customize.
So my question is: What am I doing wrong here, and is there any other way?
Set the cssclassnames in options for the chart as below. Define the classes in the css file. Below example is for table chart.
chart1.options = {
// title: "User Chart",
displayExactValues: true,
'showRowNumber': false,
'allowHtml': true,
is3D: true,
// 'height' : '350px',
cssClassNames : {
headerRow :'tableChartHeaderRow',
hoverTableRow : 'tableChartHeaderRowHighlightedState'
}
};

How to add a custom paragraph format in CKEditor

In my project I have a requirement to remove the paragraph format like "Address" and "Formatted" from the drop down and to add a new custom format called "Links" which would be Arial, 14px, bold, red. Is it possible to add custom paragraph format in CKEditor?
Use CKEDITOR.config.formatTags to specify some new formatting:
CKEDITOR.replace( 'editor1', {
format_tags: 'p;h2;h3;pre;links', // entries is displayed in "Paragraph format"
format_links: {
name: 'Links',
element: 'span',
styles: {
color: 'red',
'font-family': 'arial',
'font-weight': 'bold'
}
}
} );
To know more about styles see how CKEDITOR.styleSet works. Also note that since CKEditor 4.1, removing styles from "Paragraph format" has an impact on Advanced Content Filter.
Since you're working with Drupal, ckeditor.styles.js is the file you're looking for, this will allow you to add/edit/remove entries in the Styles menu.
Comment out any entries you don't want, and use something like this to add a new paragraph format:
{ name : 'Links', element : 'p', attributes : { 'class' : 'links' } },
This will add the CSS class links to whatever paragraph you want, and you can define the class in your theme stylesheet. Make sure to define the class in ckeditor.css if you don't see the changes applied in the CKEditor instance.
Alternatively, you could also apply the inline styles directly:
{ name : 'Links', element : 'p', attributes : { 'style' : 'font: bold 14px Arial, sans-serif; color: red;' } },
But the first method is clearly more flexible/clean.
Make sure to clear your Drupal and/or browser cache if you don't see your changes show up immediately.

Setting QDockWidget::title StyleSheet

My initial problem was to make QDockWidget title bold.
I tried this and it worked:
myDock->setStyleSheet("QDockWidget { font: bold }");
But I can't understand why the following code doesn't work:
myDock->setStyleSheet("QDockWidget::title { font: bold }";
Even if I use more complicated style sheet, every parameter of it has effect except for font: bold:
myDock->setStyleSheet("QDockWidget::title { font: bold;
text-align: left;
background: red;
padding-left: 30px; }");
What is the problem with QDockWidget::title font?
First of all, I dont know why the font does not work, I can only quess.
I have a felling that the default title bar is similar to window titlebar which is almost impossible to style.
I was searching through source code which widget is used for title bar but found nothing.. Here is some code, good luck.
I think that the style sheet does not support font changes. By default for everything derived from QWidget applies that parameters like background etc will allways work. Other stuff like font may or may not be implemented.
But why wont you make custom title bar? It can be anything bundled in QWidget.
QLabel *label = new QLabel("Header Text", myDock);
label->setStyleSheet("color: orange; font-size: 14pt; font-weight: bold;");
myDock->setWidget(bodyWidget);
myDock->setTitleBarWidget(label);
I've tested with Qt 5.3 it works, although there are missing buttons like close or undock :-/
I think that you can create them (with push button or so) and bundle everything in one widget, then set it with setTitleBarWidget and connect some signals.
There is at least hide() slot for close button and you may have to code slot for float using setFloat.
QDockWidget *dock = new QDockWidget();
QFont curFont = dock->font();
curFont.setBold(true);
dock->setFont(curFont);
Specify it like this way
MyDock->setStyleSheet("QDockWidget::title { font: 75 11pt "Ubuntu";}");
where 75 is the parameter for bold, 11pt the size of your font and "Ubuntu" the type of your font.
You're missing a semicolon (and a closing bracket?).
myDock->setStyleSheet("QDockWidget::title { font: bold; }");

css framework and color schemes

I can't find a CSS frameowrk that lets me plugin my own color scheme.
For example, in my current project I imported blueprint/screen.css. To change the color of the font, I have to change body { color..}, h2 { color..}, h3 {color..}, etc.
Isn't there something out there that provides nice css defaults, but also lets may play around with color schemes?
You can try http://lesscss.org/.
It allows you to use things such as variables in your CSS, which sounds like exactly what you're after:
// LESS
#color: #4D926F;
#header {
color: #color;
}
h2 {
color: #color;
}
Create your own CSS file that loads after Blueprint. You'll need to redefine everything, but the Blueprint defaults aren't far off from the browser defaults.
If you have multiple color schemes you want to quickly switch out, set the class on your <html> tag. Then use your CSS file to define custom styles for each.
CSS:
.theme1 body {
font-family: Tahoma;
color: #500;
}
.theme2 body {
font-family: Verdana;
color: #050;
}
For the first theme:
<html class="theme1">
For the second theme:
<html class="theme2">
Couldn't you just edit the blueprint/screen.css file? You could also use something like SASS and then create all the defaults at the top of the stylesheet and then have it go throughout the stylesheet when it renders it.

Resources