Skip to content

Commit

Permalink
Add project
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorGrycuk committed Aug 26, 2020
1 parent 76f3101 commit c84e4bd
Show file tree
Hide file tree
Showing 32 changed files with 2,541 additions and 0 deletions.
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Color Picker for StreamDeck
## Description

As a [color-blind](https://en.wikipedia.org/wiki/Color_blindness) person sometimes I struggle to recognize certain colors, so I thought it would be nice to have the functionality of [WhatColor](http://www.hikarun.com/e/) in StreamDeck. And while I was there, I decided to add the options to show their RGB or hexadecimal value.

When pressed, it will get the color information (name, RGB, or hexadecimal) of the pixel where the mouse is and show it on the StreamDeck key. Optionally, the the value can be copied to the clipboard.

Also check my [KeePass plugin](https://github.com/VictorGrycuk/StreamDeck-KeePass) for StreamDeck.

It was done using BarRaider's [Stream Deck Tools](https://github.com/BarRaider/streamdeck-tools).

## Features

#### Color Picker

When pressed, it will return either the color name, the RGB value, or the hexadecimal value of the color where the mouse is. It has the following configuration:

- **Value to show:** The value to show on the key:
- Color name
- RGB Value
- Hex Value
- **Copy value to clipboard:** If checked, it will copy the selected value to the clipboard. For the RGB it will copy the RGB value delimited by coma, for the hexadecimal value it will copy the hexadecimal without the hash character.

#### Custom Color Name

I am using the [WhatColor](http://www.hikarun.com/e/) names definition for the 16 VGA color. I might expand this, not sure.

However, I decided to leave the definition file open for customization. The file containing the definition is called `Colors.json` and can be found in the root folder of the plugin, and it consists of an array of color name and its RGB value.

However, have in mind that in its current state, the plugin has a static font size and long names might be cut off.

## Future Features

I am planning to add two different behaviour for the plugin:

- **Dynamic:** Follow the mouse around and update the data shown in the key every 1 second.
- **Fixed Dynamic:** Same as above, except at a fixed screen location.

---

The icons are modified version of *Color* and *iOS Filled* at [Icon8](https://icons8.com).
25 changes: 25 additions & 0 deletions StreamDeck.ColorPicker/StreamDeck.ColorPicker.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30002.166
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StreamDeck.ColorPicker", "StreamDeck.ColorPicker\StreamDeck.ColorPicker.csproj", "{4635D874-69C0-4010-BE46-77EF92EB1553}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4635D874-69C0-4010-BE46-77EF92EB1553}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4635D874-69C0-4010-BE46-77EF92EB1553}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4635D874-69C0-4010-BE46-77EF92EB1553}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4635D874-69C0-4010-BE46-77EF92EB1553}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DB3F7F7D-1381-46E1-B366-C7DE8A391A1C}
EndGlobalSection
EndGlobal
14 changes: 14 additions & 0 deletions StreamDeck.ColorPicker/StreamDeck.ColorPicker/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CommandLine" publicKeyToken="5a870481e358d379" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.0.0" newVersion="2.6.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
20 changes: 20 additions & 0 deletions StreamDeck.ColorPicker/StreamDeck.ColorPicker/ClipboardHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Threading;

namespace StreamDeck.ColorPicker
{
public static class ClipboardHelper
{
internal static void SendToClipboard(string text)
{
var thread = new Thread(() => ClipboardThread(text));
thread.SetApartmentState(ApartmentState.STA);
thread.IsBackground = false;
thread.Start();
}

private static void ClipboardThread(string text)
{
System.Windows.Forms.Clipboard.SetText(text);
}
}
}
62 changes: 62 additions & 0 deletions StreamDeck.ColorPicker/StreamDeck.ColorPicker/Colors.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
[
{
"Name": "Black",
"Color": "0, 0, 0"
},
{
"Name": "White",
"Color": "255, 255, 255"
},
{
"Name": "Green",
"Color": "0, 128, 0"
},
{
"Name": "Silver",
"Color": "192, 192, 192"
},
{
"Name": "Lime",
"Color": "0, 255, 0"
},
{
"Name": "Gray",
"Color": "128, 128, 128"
},
{
"Name": "Olive",
"Color": "128, 128, 0"
},
{
"Name": "Yellow",
"Color": "255, 255, 0"
},
{
"Name": "Maroon",
"Color": "128, 0, 0"
},
{
"Name": "Navy",
"Color": "0, 0, 128"
},
{
"Name": "Red",
"Color": "255, 0, 0"
},
{
"Name": "Blue",
"Color": "0, 0, 255"
},
{
"Name": "Purple",
"Color": "128, 0, 128"
},
{
"Name": "Teal",
"Color": "0, 128, 128"
},
{
"Name": "Fuchsia",
"Color": "255, 0, 255"
}
]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions StreamDeck.ColorPicker/StreamDeck.ColorPicker/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using BarRaider.SdTools;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace StreamDeck.ColorPicker
{
class Program
{
static void Main(string[] args)
{
// Uncomment this line of code to allow for debugging
//while (!System.Diagnostics.Debugger.IsAttached) { System.Threading.Thread.Sleep(100); }

SDWrapper.Run(args);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("StreamDeck.ColorPicker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StreamDeck.ColorPicker")]
[assembly: AssemblyCopyright("Copyright © 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d8413481-5a2d-4c72-a010-25100d668729")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui,viewport-fit=cover">
<meta name=apple-mobile-web-app-capable content=yes>
<meta name=apple-mobile-web-app-status-bar-style content=black>
<title>StreamDeck.ColorPicker Settings</title>
<link rel="stylesheet" href="sdpi.css">
<script src="sdtools.common.js"></script>
<script src="PluginActionPI.js"></script>
</head>
<body>
<div class="sdpi-wrapper">
<div class="sdpi-item" id="dvValueToShow">
<div class="sdpi-item-label">Value to show</div>
<select class="sdpi-item-value select sdProperty" id="valueToShow" oninput="setSettings()">
<option value="colorName">Color name</option>
<option value="RGBValue">RGB Value</option>
<option value="hexValue">Hex Value</option>
</select>
</div>
<div type="checkbox" class="sdpi-item" id="configuration">
<div class="sdpi-item-label">Copy value to clipboard</div>
<div class="sdpi-item-value min100">
<div class="sdpi-item-child">
<input id="copyToClipboard" class="sdProperty sdCheckbox" type="checkbox" name="configuration" oninput="setSettings()">
<label for="copyToClipboard" class="sdpi-item-label"><span></span>Copy</label>
</div>
</div>
</div>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no,minimal-ui,viewport-fit=cover">
<meta name=apple-mobile-web-app-capable content=yes>
<meta name=apple-mobile-web-app-status-bar-style content=black>
<title>StreamDeck.ColorPicker Settings</title>
<link rel="stylesheet" href="sdpi.css">
<script src="sdtools.common.js"></script>
<script src="PluginActionPI.js"></script>
</head>
<body>
<div class="sdpi-wrapper">
<div class="sdpi-item" id="dvValueToShow">
<div class="sdpi-item-label">Value to show</div>
<select class="sdpi-item-value select sdProperty" id="valueToShow" oninput="setSettings()">
<option value="colorName">Color name</option>
<option value="RGBValue">RGB Value</option>
<option value="hexValue">Hex Value</option>
</select>
</div>
<div type="checkbox" class="sdpi-item" id="configuration">
<div class="sdpi-item-label">Copy value to clipboard</div>
<div class="sdpi-item-value min100">
<div class="sdpi-item-child">
<input id="copyToClipboard" class="sdProperty sdCheckbox" type="checkbox" name="configuration" oninput="setSettings()">
<label for="copyToClipboard" class="sdpi-item-label"><span></span>Copy</label>
</div>
</div>
</div>
</div>
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c84e4bd

Please sign in to comment.