How to obtain the SASS function that associates two specific colours? - css

I have the following two colours:
$light-green: #99E2D0;
$dark-green: #008766;
I'm sure I can get the dark green from the lighter green by using a SASS function (I noticed they have the same hue). I have tried many combinations using lighten(), darken(), saturate(), etc... but have not succeeded. I ask the following question: is there a way to find out which function associates two specific colours? Do you know which function I have to use to get that colour? Thank you in advance

You can use online tool to find that for you such as Sass Colour Function Calculator.
In your example:
$light-green: #99E2D0;
$dark-green: darken(saturate($light-green, 44.27), 47.84);

Related

defining custom color pallete in R

Hey I want to create my own custom palette of color in R using the brewer.pal() function. And then I want to view it using the image function.
ny<-brewer.pal(7,"Blues")
image(x=1:7,y=1,z=as.matrix(1:7),col=ny)
This code gives 7 shdes of blue, however i want to give my own choice of 7 different colors.
image(x=1:7,y=1,z=as.matrix(1:7),col=c("Reds","Blues"))
I thought of trying this function, but its obvious wrong. Can someone please help me. I specifically want to use the brewer.pal() and image() funcions
If you'd prefer a gradient between 2+ colors of your choosing, you could also use colorRampPalette
pretty = colorRampPalette(c('#EF6780', '#80ef67', '#6780ef'))
image(x=1:7,y=1,z=as.matrix(1:7),col=pretty(200))
You can specify colors as hexadecimal colors in R. For example
image(x=1:7,y=1,z=as.matrix(1:7),col= "#CC6666")
References:
http://www.color-hex.com/
http://www.cookbook-r.com/Graphs/Colors_(ggplot2)/

Calculate distinguishable color palette in R

I am using R to create a plot that contains 20 distinct groups, and I would like to color each of them differently. I am also familiar with Matlab and when working with that program I have found that "distinguishable_colors" matlab file worked best for distinguishing different colors 1. I have looked at the "rainbow", "rainbow_hcl", and "brewer" palettes, but none of them look as good as "distinguishable_colors.mat". I am wondering if anyone knows of a function in R that will create the same palette as the "distinguishable_colors.mat" matlab function?
That function in MatLab seems to iteratively search over RBG space for sets of color which are maximally different from each other. I don't know of such a thing in R, but we can come pretty close.
We can find a color palette of a few colors which suits our needs (perhaps using http://colorbrewer2.org/) and use those seed color to create a colorRampPalette for any number of colors.
pal<-colorRampPalette(c('#e41a1c','#377eb8','#4daf4a','#984ea3','#ff7f00'))
N=10
plot(rnorm(N),rnorm(N),pch=16,col=pal(N),cex=3)
The R package Polychrome provides tools for qualitative palettes with many (20 or more) colors. It comes with two vignettes giving the provided palettes and tools for creating palettes.

Replacing one d3 visualisation with another d3 visualisation in same place?

I'm using the datamaps library for d3 and I have asked the question unsuccessfully there on github so I wanted to cross-post it here.
What I'm trying to do is to visualise two measures – Income Inequality (Gini) and GDP per capita – in one world map and make it possible to switch between the two views.
I am almost there. Here is my example.
On the top you can choose which measure to look at and the updating works – except that the updated map is plotted underneath the previous one and not on top. This is happening even though I'm referring to the same id with both maps.
What am I missing?
Thanks for helping me!
EDIT: I managed to get it a little bit nicer – here is the updated version – but the maps are still printed over and over again below the space where they should appear.
I made a lot of these same mistakes when I first used D3. You have to use an enter(), update(), exit() pattern. There are lots of good tutorials on how to do that. Fundamentally, your structure is not setup correctly and is going to give you trouble.
For your code, you want to do the following:
Move the initial call to map() inside the map function.
Nest the map() function inside another function where you config your variables. You need to do all your global data/variable defining here.
Inside that config function, include d3.select(#radialbuttonname) and re run the map() function to update the chart on.click.
Inside the map function, you need to create functions for .data().enter(), .data.exit().remove(), and .data().transition(). That will replace the same SVG map area with a new map rather than just appending more svg's below.
You can change the tooltips and those other elements with if/then operators and remove() inside the map() function.
That should get you on your way..

Default variables for colors in Bootstrap LESS?

I am using Bootstrap Less for some project, and I want to make it to change colors of css according to some variables. I have look up for this solution
http://www.lavishbootstrap.com/
This is great, but i have one problem, i dont know what are the names of those variables, that i can choose colors. please take a look at seven color that are generated.
All I need is seven less variables that Bootstrap using for color
like this one
#brand-primary;
#brand-success;
#brand-warning;
#brand-danger;
#brand-info;
Can someone tell me the names for those seven variables from example link i send?
I mean just names of variables that are using those colors
The variables you're looking for are (in the order they're listed on LavishBootstrap):
#body-bg
#gray-lighter
#gray-light
#gray
#brand-primary
#table-border-color
#navbar-inverse-bg

Plot different colours - Scilab

Is it possible to have different colours in my plot in Scilab? I use the mtlb_hold to hold the graph and it works fine, but my problem is that then I have the same colours in my graph. In Matlab with the hold command, I have different colours. Is it possible to have different colours in Scilab too?
Thank you in advance.
Just found it. In the plot function, for example plot(), you can pass a second argument which specifies the color that will be used. For example, you can use use b for blue color, g for green, r for red and call plot() like this: plot(z,"r").
The SciLab documentation provides examples for using colors:
https://help.scilab.org/doc/5.3.3/en_US/color.html
The plot2d()-function e.g. accepts an attribute style, where you can even specify a color for each function with its full name:
plot2d(x,[sin(x),cos(x)],style=[color("red"),color("green")]);

Resources