Last active
April 8, 2019 14:43
-
-
Save SirJson/13bfaa7a4756a0caf22adaf45f7ab8cb to your computer and use it in GitHub Desktop.
Material Fonts and Sizes for fman + HiDPI fix. Version 3. Includes the SCSS source file with all my notes and the resulting CSS file for use in fman. Note: I did not update the source scss file yet.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////////// | |
// Material Typeface Rules for fman | |
//////////////////////////////////// | |
// This is written for Qt5 / fman. | |
// Why? While I really like the color scheme I'm just more used to a larger font size which meant I had a hard time reading what fman is showing me. | |
// I also noticed some problems which going from a "standard" display to a high DPI display in a multi monitor setup. | |
// I don't think this will slove the problem yet but that's how everything started. | |
/* Notes and Research */ | |
// According to the Qt5 documentation qcss is quite limited in what it can do in terms of styling. | |
// For example font-size only supports px and pt instead of also supporting "rem" or "em", but it seems fman will only accept "pt" anyways. | |
// Some key units that I found online | |
// ------------------------ | |
// - 1 px = 0.75 point | |
// - 1pt is 1.333333px :( | |
// - 1rem = 16px in a 96dpi web browser | |
// - 1 google unit = 0.0625rem | |
// ------------------------ | |
// NOTE: letter-spacing is unfortunately not supported (yet?). Could be maybe exposed via the QFont class... | |
// NOTE: This written for 96dpi what I assume most users use these days. It really depends on the screen size and resolution. | |
// If you are one of the happy user that owns a high DPI display you might have to tweak the formula. | |
// A good start is how your browser understands "1rem" in high DPI mode expressed in "px". | |
// Reference: https://material.io/design/typography/the-type-system.html | |
// The base CSS file I copied from the Core Plugin: https://github.com/fman-users/Core/blob/master/Theme.css | |
// In case you need a 'Licence' have a look here: https://creativecommons.org/publicdomain/zero/1.0/deed.de (CC0 1.0 also known as Public Domain in some places) | |
// NOTE: The licence only applys to the modifications I made. The original Theme.css is untouched by this! | |
// Lastly even though you don't need to if you are more experienced in design and or sass I would be more than happy | |
// if you contribute advice or changes back to me so everyone can benefit from them. | |
/*********************************/ | |
/* == SCSS magic starts here === */ | |
/*********************************/ | |
// The workhorse function for this stylesheet. | |
// | |
// All base units and numbers are defined here and the main formula. | |
// $size is a number without suffix and represents what I call "Google units" | |
// This function will return your google units as fman compatible pt | |
// | |
// For more infomation lookup the type scale table here: https://material.io/design/typography/the-type-system.html#type-scale | |
@function gtype-scale($size) { | |
$groot-unit: 0.0625; //rem | |
$unit-rem: 16; //px | |
$px-unit: 0.75pt; | |
// Qt doesn't like floating point pts | |
@return floor(($size * $groot-unit) * $unit-rem * $px-unit); | |
} | |
// Some precalculated numbers for different type scale levels. | |
// If you look at the type scale table you will notice that not every scale level is implemented. | |
// This is intentional but feel free to add the scales that you need. | |
$scale-body1: gtype-scale(16); | |
$scale-body2: gtype-scale(14); | |
$scale-subtitle1: gtype-scale(16); | |
$scale-subtitle2: gtype-scale(14); | |
$scale-caption: gtype-scale(12); | |
$scale-heading5: gtype-scale(24); | |
$scale-heading6: gtype-scale(20); | |
$medium-font: 500; // 500 = Medium weight. Not supported by Noto Sans. | |
$regular-font: normal; | |
// All levels are compsed as mixins for easier handling | |
// ... it is a system after all | |
@mixin body1 { | |
font-size: $scale-body1; | |
font-weight: $regular-font; | |
} | |
@mixin subtitle2 { | |
font-size: $scale-subtitle2; | |
font-weight: $medium-font; | |
} | |
@mixin caption { | |
font-size: $scale-caption; | |
font-weight: $regular-font; | |
} | |
@mixin heading5 { | |
font-size: $scale-heading5; | |
font-weight: $regular-font; | |
} | |
@mixin heading6 { | |
font-size: $scale-heading6; | |
font-weight: $medium-font; | |
} | |
/***************************************/ | |
/* == fman style rules start here === */ | |
/*************************************/ | |
* { | |
font-family: Roboto, Noto Sans, Segoe UI, Ubuntu, sans-serif; | |
@include body1; | |
} | |
th { | |
vertical-align: center; | |
@include subtitle2; | |
} | |
.statusbar { | |
padding: 4px; | |
@include body1; | |
} | |
.quicksearch-query, .quicksearch-item-title { | |
@include heading6; | |
} | |
.quicksearch-item { | |
padding-top: 1px; | |
padding-left: 4px; | |
padding-right: 4px; | |
border-top: 1px solid #4d4d4d; | |
border-bottom: 1px solid #363636; | |
@include heading5; | |
} | |
.quicksearch-item-title { | |
color: #c8c8c8; | |
} | |
.quicksearch-item-title-highlight { | |
color: white; | |
} | |
.quicksearch-item-hint { | |
color: white; | |
} | |
.quicksearch-item-description { | |
color: #8f908a; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
font-family: Roboto, Noto Sans, Segoe UI, Ubuntu, sans-serif; | |
font-size: 12pt; | |
font-weight: normal; | |
} | |
th { | |
vertical-align: center; | |
font-size: 10pt; | |
padding-top: 8px; | |
height: 24px; | |
} | |
.statusbar { | |
padding: 3px; | |
font-size: 10pt; | |
font-weight: normal; | |
} | |
.quicksearch-query, .quicksearch-item-title { | |
font-size: 15pt; | |
font-weight: 500; | |
} | |
.quicksearch-item { | |
padding-top: 1px; | |
padding-left: 4px; | |
padding-right: 4px; | |
border-top: 1px solid #4d4d4d; | |
border-bottom: 1px solid #363636; | |
font-size: 18pt; | |
font-weight: normal; | |
} | |
.quicksearch-item-title { | |
color: #c8c8c8; | |
} | |
.quicksearch-item-title-highlight { | |
color: white; | |
} | |
.quicksearch-item-hint { | |
color: white; | |
} | |
.quicksearch-item-description { | |
color: #8f908a; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment