Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

generate random dark colors programatically in android

Random rnd = new Random();
paint.setARGB(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
Comment

generate random light colors programatically in android

<?xml version="1.0" encoding="utf-8"?>
<resources>

<item name="blue" type="color">#FF33B5E5</item>
<item name="purple" type="color">#FFAA66CC</item>
<item name="green" type="color">#FF99CC00</item>
<item name="orange" type="color">#FFFFBB33</item>
<item name="red" type="color">#FFFF4444</item>
<item name="darkblue" type="color">#FF0099CC</item>
<item name="darkpurple" type="color">#FF9933CC</item>
<item name="darkgreen" type="color">#FF669900</item>
<item name="darkorange" type="color">#FFFF8800</item>
<item name="darkred" type="color">#FFCC0000</item>

<integer-array name="androidcolors">
    <item>@color/blue</item>
    <item>@color/purple</item>
    <item>@color/green</item>
    <item>@color/orange</item>
    <item>@color/red</item>
    <item>@color/darkblue</item>
    <item>@color/darkpurple</item>
    <item>@color/darkgreen</item>
    <item>@color/darkorange</item>
    <item>@color/darkred</item>
</integer-array>

</resources>
Comment

generate random light color android

final Random mRandom = new Random(System.currentTimeMillis());

public int generateRandomColor() {
    // This is the base color which will be mixed with the generated one
    final int baseColor = Color.WHITE;

    final int baseRed = Color.red(baseColor);
    final int baseGreen = Color.green(baseColor);
    final int baseBlue = Color.blue(baseColor);

    final int red = (baseRed + mRandom.nextInt(256)) / 2;
    final int green = (baseGreen + mRandom.nextInt(256)) / 2;
    final int blue = (baseBlue + mRandom.nextInt(256)) / 2;

    return Color.rgb(red, green, blue);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# class where T : enum 
Csharp :: unrecognized escape sequence c# connection string 
Csharp :: Untiy particle system play 
Csharp :: unity record animation at runtime 
Csharp :: c# timestamp 
Csharp :: wpf repository pattern query async with includes properties 
Csharp :: .net return manual status code 
Csharp :: C# Compound Assignment Operator 
Csharp :: closedxm Iworksheet excel formulal 
Csharp :: Focus on last entry in listbox 
Csharp :: is and as in c# 
Csharp :: username and password into base64 encoding c# 
Csharp :: c# one dimensional dictionary 
Csharp :: c# ef dynamic ApplyConfiguration 
Csharp :: read barcode with barcode scanner c# winform serial port number 
Csharp :: winforms lifecycle 
Csharp :: alpahbet incremnet in c# 
Csharp :: Dictionary of array in C# 
Csharp :: telerik mvc grid round sum result 
Csharp :: add-users:430 Uncaught TypeError: $(...).validate is not a function 
Csharp :: how to open or close combobox in c# 
Csharp :: unity check if transform doent have parent 
Csharp :: c# read key without writing 
Csharp :: c sharp if statements 
Csharp :: c# async rethrow exception 
Csharp :: unity custom editor draw line in scene 
Csharp :: auto paly a video control in mvc c# 
Csharp :: reflection assemblies gettypes 
Csharp :: c# unary operator 
Csharp :: csvhelper driver c# nuget 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =