Tutorial by Examples: color

The original default colourmap of MATLAB (replaced in version R2014b) called jet is ubiquitous due to its high contrast and familiarity (and was the default of matplotlib for compatibility reasons). Despite its popularity, traditional colormaps often have deficiencies when it comes to representing d...
The below code example will give you an adjusted version of that color where a higher percentage will be brighter and a lower percentage will be darker. Objective-C + (UIColor *)adjustedColorForColor:(UIColor *)c : (double)percent { if (percent < 0) percent = 0; CGFloat r, g, b...
In Highcharts, there is an array containing the default colors for the chart's series. When all colors are used, new colors are pulled from the start again. Defaults colors for version 4.x and 5.x are: colors: [ '#7cb5ec', '#434348', '#90ed7d', '#f7a35c', '#8085e9', ...
<svg width="800px" height="600px"> <defs> <filter id="greyscale"> <feColorMatrix type="matrix" values="0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0...
<svg width="800px" height="600px"> <defs> <filter id="greyscale"> <feColorMatrix type="matrix" values="0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 ...
<svg width="800px" height="600px"> <defs> <filter id="greyscale"> <feColorMatrix type="matrix" values=".2 .2 .2 0 0 .6 .6 .6 0 0 .2 .2 .2 0 0 ...
// Get the current colors of the gradient. let oldColors = self.gradientLayer.colors // Define the new colors for the gradient. let newColors = [UIColor.red.cgColor, UIColor.yellow.cgColor] // Set the new colors of the gradient. self.gradientLayer.colors = newColors // Initia...
Objective-C UIColor *color = [UIColor redColor]; NSString *textToFind = @"redword"; NSMutableAttributedString *attrsString = [[NSMutableAttributedString alloc] initWithAttributedString:yourLabel.attributedText]; // search for word occurrence NSRange range = [yourLabel.text rangeO...
shadowColor = color // CSS color shadowBlur = width // integer blur width shadowOffsetX = distance // shadow is moved horizontally by this offset shadowOffsetY = distance // shadow is moved vertically by this offset This set of attributes will add a shadow around a path. Bo...
git log --graph --pretty=format:'%C(red)%h%Creset -%C(yellow)%d%Creset %s %C(green)(%cr) %C(yellow)<%an>%Creset' The format option allows you to specify your own log output format: ParameterDetails%C(color_name)option colors the output that comes after it%h or %Habbreviates commit hash (us...
Creating Gradient UIImage with colors in CGRect Swift: extension UIImage { static func gradientImageWithBounds(bounds: CGRect, colors: [CGColor]) -> UIImage { let gradientLayer = CAGradientLayer() gradientLayer.frame = bounds gradientLayer.colors = colors ...
We can change the style of the placeholder by setting attributedPlaceholder (a NSAttributedString). var placeholderAttributes = [String: AnyObject]() placeholderAttributes[NSForegroundColorAttributeName] = color placeholderAttributes[NSFontAttributeName] = font if let placeholder = textField.p...
CSS .bordered { border-image: linear-gradient(to right, red 20%, green 20%, green 40%, blue 40%, blue 60%, maroon 60%, maroon 80%, chocolate 80%); /* gradient with required colors */ border-image-slice: 1; } HTML <div class='bordered'>Border on all sides</div> The above ex...
#demo-element { background: @theme-color; color: contrast(@theme-color, black, white, 50%); } @theme-color: red; The above example will set the text color of the element as white if the background-color is dark and vice-versa. This is achieved using the contrast() color operation functi...
You can create a UIColor object using an image pattern by using the UIColor(patternImage:_) method. btn.backgroundColor = UIColor(patternImage: UIImage(named: "image")!)
<svg width="800px" height="600px" > <defs> <filter id="posterize" color-interpolation-filters="sRGB"> <feComponentTransfer> <feFuncR type="discrete" tableValues="0 0.25 0.75 1.0"/> ...
Objective-C UILabel *label = [[UILabel alloc] init]; label.highlighted = YES; label.highlightedTextColor = [UIColor redColor]; Swift let label = UILabel() label.highlighted = true label.highlightedTextColor = UIColor.redColor() Swift 3 let label = UILabel() label.isHighlighted = true ...
Provided that barButtonItem has a non-null image property (e.g. set in the Interface Builder). Objective-C barButtonItem.image = [barButtonItem.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
To manipulate colors we will modify the argb (Alpha, Red, Green and Blue) values of a color. First extract RGB values from your color. int yourColor = Color.parse("#ae1f67"); int red = Color.red(yourColor); int green = Color.green(yourColor); int blue = Color.blue(yourColor); Now...
Progress bars can be styled with the progress[value] selector. This example gives a progress bar a width of 250px and a height of 20px progress[value] { width: 250px; height: 20px; } Progress bars can be especially difficult to style. Chrome / Safari / Opera These browsers use the -web...

Page 3 of 6