I am using react navigation's theme functionality to switch between dark and light mode and getting the colors for the mode with const { colors } = useTheme(); However I am trying to set colors in a stylesheet. How should I go about doing this. I have been doing {[styles.subtitle, colors.text]} to set styles on components. Is there a cleaner way to do this? Such as setting the color inside the styles.subtitle object?
Make your stylesheet in the body of your component. Define const { colors } = useTheme(); and then directly beneath that (instead of at the bottom of the file), create your stylesheet
Related
Using the SASS build for Kendo Angular Material I wish to simply change the primary, secondary and accent colors for the entire theme and then download.
There is only a drop down to select a color palette, but no way to choose specific colors.
When I download the variables.scss, there aren't entries for these three colors.
Question: How do I edit the variables.scss to change these three colors?
If you click the "<" on top of your screenshot, you can hide this panel and edit the colors.
If you're using npm, you can install the theme you want:
npm install #progress/kendo-theme-material
Then import the theme in your own scss file, where you can override some of the values:
$primary-palette-name: blue;
$secondary-palette-name: pink;
#import "~#progress/kendo-theme-material/dist/all.scss";
The documentation is here: https://docs.telerik.com/kendo-ui/styles-and-layout/sass-themes
The variables are here: https://github.com/telerik/kendo-themes/blob/develop/packages/material/scss/_variables.scss
I am trying to move over from Bootstrap to Zurb Foundation.
Bootstrap uses *-color for text colour and *-bg for background colours.
I'm a little confused with Foundation's naming scheme:
What is the difference between $topbar-link-bg-hoverand $topbar-link-bg-color-hover?
Both their names suggest that they change the background colour of a link in the top bar, both are given a colour.
Foundation structure has lots of details, if you search these variables in Foundation you can find them in _top-bar.scss file. Look at it, how used these variables:
// Apply the hover link color when it has that class
&:hover:not(.has-form) > a {
background-color: $topbar-link-bg-color-hover;
#if ($topbar-link-bg-hover) {
background: $topbar-link-bg-hover;
}
}
$topbar-link-bg-color-hover value can equal with color because use for background-color and $topbar-link-bg-hover value can equal with image or anything else(background css values).
I'm trying to use CKEditor simply as an API that I can drive with my own UI.
Firstly, is this the right use of CKEditor?
If so, how could I modify the font size of a text selection programmatically?
Creating own UI for CKEditor
It's a doable approach, but for some cases it might be tough and require some code duplication.
There are older parts of CKE that encapsulate many useful things, so you have no convenient API to access it from outside.
Adding a font size
The minimal effort would be to simply use CKEDITOR.style objects.
var editor = CKEDITOR.instances.editor1;
var style = new CKEDITOR.style( {
element: 'span',
styles: { 'font-size': '20px' }
} );
editor.applyStyle( style );
For more examples see font plugin, you're interested in fontSize combobox.
I have an app that's design for the black theme, Is it possible to force the black theme on the particular app.
Could I set the default font in my pages to be of a certain size and color?
Yes you can force it, but it won't pass the certification. Your app should be able work with black and white theme. Try to make your app "theme aware", use StaticResource like PhoneAccentColor. Use this code to detect the theme:
public bool LightThemeEnabled
{
get
{
return (Visibility)Application.Current.Resources["PhoneLightThemeVisibility"] == Visibility.Visible;
}
}
Ref
is it possible to change the background-color of e.g. the first icon of this site with CSS3, or WebKit’s CSS extensions?
I'm new to this and would appreciate some help. A link or an example would be great.
Thank you in advance.
Although you can style an Image, but changing color of Icon is not possible in CSS3 as it requires Blending modes.
You can achieve this with HTML5 Canvas
// Color
var over = someCanvas.getContext('2d');
// Icon
var under = anotherCanvas.getContext('2d');
over.blendOnto( under, 'screen', {destX:30,destY:15} );
use https://github.com/Phrogz/context-blender for achieving this.
If the icon image had a transparent background, then you could set the CSS background colour behind the image like this:
background: #c00 url(kombine-iphone-icons.png); /* Puts a red background behind the icon image */
Unfortunately, there’s nothing in CSS 3 (or any of WebKit’s CSS extensions) that lets you change the colour of images.
Try
img {
background-color: #FF00FF;
}
Yes, you can style an image with css3. But something tells me that you question is actually more specific that it looks like..