How To Duplicate Product Attribute Variations in WooCommerce - wordpress

I've hundreds of variations and around every 5 variations have the same values. The scenario is the following.
I've Color attribute and variations are Red, Green, Blue.
and Size attribute has: X, XL, XXL, L, S, M
I am setting attribute variations like the following.
Red - X,
Red - XL,
Red - XXL,
Red - L,
Red - S,
Red - M
Green - X,
Green - XL,
Green - XXL,
Green - L,
Green - S,
Green - M
Blue - X,
Blue - XL,
Blue - XXL,
Blue - L,
Blue - S,
Blue - M
For each color set, there is the same variation image, quantity, and stock limits.
How can create variations without repeating myself?
Thank You

This is an interesting issue. I have faced this and tried a couple of solutions. But recently I found a plugin that can duplicate your variation and image as your need.
You need to create one variation first then you can duplicate that variation 5 times so that you will get another 5 Red - X variation with all the attributes where you need to change the size only (with your example)
You can check out this link,

Related

rect.hclust integer vector for "border" parameter

Clearly one can use an integer vector for the border parameter of rect.hclustL
x <- rect.hclust(foo, k=ncuts, which = c(2,7), border = 3:4)
So imagine I have ncuts and wish to have "pseudo"-unique coloring of each border cut:
x <- rect.hclust(foo, k=ncuts, which = c(2,7), border = 1:ncuts)
Clearly the border color list that is being selected is finite - but what are the actual colors?
I started looking through documentation and no leads there, I moved on to a cursory view of the source code - and nothing there either.
By observation I noticed the colors appear to be (limited to):
Black
Red
Green
Violet
Light Blue
Magenta
Yellow
White
But how are they defined - and more importantly say that I wanted to associate the cuts with the appropriate color later on - could I do it?
UPDATE:
The coloring of dendrogram borders when defined by a numerical color lists occurs strictly from Left to Right (Black, Red, Green3, Blue, Cyan, Magenta, Yellow Grey, Black, Red ...). The question then becomes - how can I associate / locate a cut's position within the dendrogram.

Understanding color matrix of hue

This is a color matrix in ARGB:
[
R,0,0,0,0,
0,G,0,0,0,
0,0,B,0,0,
0,0,0,A,0,
0,0,0,0,1
]
And I know its hue color matrix below:
(
refers to gskinner's source code:
http://gskinner.com/blog/archives/2007/12/colormatrix_cla.html
)
define lr=0.213
define lg=0.715
define lb=0.072
define a=0.143
define b=0.140
define c=-0.283
define hueangle
define cos=cos(hueangle)
define sin=sin(hueangle)
[
lr+cos*(1-lr)+sin*(-lr),lg+cos*(-lg) +sin*(-lg),lb+cos(-lb) +sin*(1-lb),0,0,
lr+cos*(-lr)+ sin*(a),lg+cos*(1-lg)+sin*(b),lb+cos(-lb) +sin*(c),0,0,
lr+cos*(-lr)+ sin*(-(1-lr)),lg+cos*(-lg) +sin*(lg) ,lb+cos(1-lb)+sin*(lb),0,0,
0,0,0,1,0,
0,0,0,0,1
]
(Thanks son_of_fire for pointing out the inexplicitness of the questions in the last edition.)
Question
What formulas led to this hue matrix especially the numbers a,b and c in it?
lr, lg, and lb are the luminance constants. If you compute the dot product of <R, G, B> with <lr, lg, lb> you'll get the luminance of the color. This is useful if you want to change the hue and/or saturation without changing the luminance of the color.
I don't recognize a, b, and c off the top of my head. They're probably chrominance (saturation)-related.
The hueangle is the angle you want to rotate your color. It rotates around the R=G=B axis. If you rotate 180° red becomes cyan, green becomes magenta, yellow becomes blue, etc.
You might find the Gamma FAQ useful, as it describes a lot of these concepts. And this page describes the math behind rotating around an arbitrary axis.
Also, you generally want a 4x4 matrix for color conversion, not 5x5.

Equation behind the pixels grayscale

I have an image in grayscale and colored form,and
I want to know the pixel grayscale equation?
so I trace the same pixels on both images
red=119 green=198 blue=122
red=169 green=169 blue=169
red=0 green=133 blue=184
red=119 green=119 blue=119
red=119 green=74 blue=180
red=94 green=94 blue=94
what is the equation?
The following equation brings the same results (round to the nearest integer) :
gray = 0.1313*r + 0.6781*g + 0.1566*b;
(used this site for solving the 3 unknown equation as suggested in Nikita's comment)
"Grayscale: Converting color to grayscale"
Note that the 0.299, 0.587 and 0.114 are absolutes for each colors weight as they all have different luminance. In simple terms, green is lighter than red and blue where blue is the darkest of three.
More info can be found here.

Visual Studio 2010 custom color picker

On the right end, there is a vertical slider, which I think is meant for you to choose the "intensity" of the color, eg darker red or paler red. Is this correct?
The second question, as a layman to colors, I'd thought a dark red and a pale red has the same RGB proportion? But apparently this is not the case. Are darker color and paler color of the same color actually to non-related colors?
On question 1 yes, in laymans term it increases the intensity. But what really happens is this
double R;
double G;
double B;
double Luminosity = Math.Sqrt(.0241 * (Math.Pow(R, 2)) + 0.691 * (Math.Pow(G, 2)) + 0.068 * (Math.Pow(B, 2)));
Which is a formula for Luminosity based on RGB

Get hex codes for all colors between two colors?

I want to have buttons that are switching from one color to another.
Eg. 1000 buttons where the first one is yellow and the last one is green and all the between will slowly move from yellow to green.
How can I generate all the hex codes for colors (eg. #8a3a3a) between these two colors?
Split the two input colors into red, green, blue components and convert them to float. Subtract source components from destination components, divide each by 1000 and call them f.ex. deltaRed, deltaGreen, deltaBlue. Start with source components, convert those into a "#rrggbb" string 1000 times, each loop adding the deltas. If you want to actually reach the destination color, you have to loop from 0 to 1000, ie. 1001 times.
Yes, it is. You can compute it as follows:
Imagine the colors are points in a three-dimensional space, with each component (red, green, blue) representing one dimension. Depending on how many color tones you want between the two colors, you can try to evenly divide the differences between the two colors, for each component separately. For instance, if rA is the red component of color A, and rB the red component of color B, and if you want 10 steps in between, then the red component of the second step is r2 = (rB - rA) * 2 / 10.
Convert the components to decimal first (e.g. 8a => 138), and you should probably write a small program for the computation. I don't think you need so many tones though, because each component has only a range from 0 to 255 (rounding necessary), and the human eye cannot differentiate between so many colors anyway.
This may be what you need: http://sandbox.leigeber.com/fader/fader.html
Code: http://www.leigeber.com/wp-content/uploads/2008/05/fader.zip

Resources