Microsoft Windows 10 Great UI Changes

My first experience with Windows 8 inspired bafflement and frustration. But I walked away from my first few minutes with Windows 10 with a sense of jealousy. It looks like a significant improvement, and I want it on my PC right now.

Microsoft is launching Windows 10 as the new face of both Windows and eventually Windows Phone. At one point during Microsoft’s Tuesday press event, Terry Myerson, the executive vice president in charge of Microsoft’s OS group, called the new OS “our most open, collaborative OS project ever.” Collaborative, indeed. Microsoft is looking for user feedback, and what I demo’d on Tuesday may not be the same OS that customers receive next year.

Microsoft executives didn’t even characterize the system as an alpha; they referred to it as a “build.” So with Windows 10 tentatively scheduled to be launched around the middle of 2015, there’s quite a bit of time to change, remove or add features before the system launches.

windows10 tech preview start menuIMAGE: MICROSOFT

The Windows 10 Start Menu fues Windows 7 icons and Windows 8 Live Tiles.

That said, we can still point to various features that embody the new Windows 10 experience, and will almost certainly make the cut. These include the revamped Start menu; the new “task view,” virtual desktops and ALT-TAB features; windowed apps; and the new “snap assist” capability. Granted, I had a just a few moments to play around with each. But I quite liked what I saw, and if you sign up for the new Windows Insider program, you’ll have a chance to form your own impressions beginning on Wednesday.

The revamped Start Menu: clean, intuitive

I’m not wholeheartedly in love with the new Start Menu. Aesthetically, it looks like someone surgically conjoined the Windows 7 and Windows 8 experience. Move past that inelegance, however, and it’s darn useful. On the left, there’s a list of frequently used apps, along with shortcuts to PC settings, as well as your documents and pictures folders. At the bottom, there’s a shortcut to launch an “all apps” view.

On the right, the Live Tiles reproduce the functionality of the Windows 8 Start screen, with resizeable tiles that can dynamically show you how much unread mail is left. It appears that you should think of Live Tiles more like notifications rather than app shortcuts, although you can use them either way. Microsoft’s demo station had a large oversize tile showing the current calendar appointment, which seemed appropriate.

windows 10 start menu longMARK HACHMAN

If you want, you can resize the Start menu, increasing or decreasing its size and adjusting its position.

Also, if you want to resize the Start menu itself, you’re free to do so.

As some leaked videos foreshadowed, you can revert to the Windows 8 Start page, if you so choose. But that option wasn’t checked off, leading me to believe that most people would prefer the desktop experience.

A new Windows world: Task view, virtual desktops, and ALT-TAB

One of the Microsoft executives I talked to referred to the new “task view” as a “poor man’s multimonitor setup.” I can understand why.

Virtually all Windows users use ALT-TAB to quickly shuffle between windows. It’s a great way to move from one task to the next. That capability is still available in Windows 10.

windows 10 alt tabMARK HACHMAN

Using Alt-TAB to cycle through windows isn’t that different than Windows 8, but you can see more of what each window holds.

What’s different, however, is the new “task view” button. Down in the Windows 10 taskbar, third from the left, is a button that, when clicked, brings up an array of “virtual desktops.”

What’s a virtual desktop? Think of it as a virtual display.

If you’re running a multimonitor set-up, chances are you’re already allocating different applications to different screens: a browser window on one display, Outlook on another, and maybe a chat app on your docked notebook. But with Windows 10, Microsoft allows you to snap more than one app to a screen. So if you choose, you could fill a secondary monitor with an Outlook pane and a PowerPoint file that you’re referencing in an email to the colleague.

windows 10 taskbarMARK HACHMAN

The Windows 10 taskbar includes the Windows button, which launches the Start menu, the new Task View button, and the Search button. To the far right, the “underlined” apps show that they’re located inside a virtual desktop.

But if you have one monitor, tapping the task view button—or more usefully, Windows+TAB—swaps between desktops, which are displayed on the bottom of the display. So if you have a “project screen” with PowerPoint, a browser window, and OneNote all contained within it, you can swap to an entirely different virtual desktop, or workspace, perhaps with Facebook and Xbox Music. You’ll also notice the apps themselves are shown above the desktops themselves, so if you can’t remember what virtual desktop actually owned that app, you can just jump into it regardless.

There’s also a feature that may or may not make it to final release: On your taskbar, you’re probably used to instances of multiple browser windows stacked on one another. But in Windows 10, you may also see that app “underlined” by a horizontal bar, showing that it’s in a virtual desktop.

windows10 tech preview virtual desktopIMAGE: MICROSOFT

The new task view shows you your virtual desktops, and the apps contained within them.

For now, virtual desktops are a convenience, but they could also emerge as a security feature, allowing users to assign permissions to different ones. Microsoft officials wouldn’t tell me if they’ll be isolated from one another or “sandboxed” over time.

Snap snaps with Snap Assist and windowed apps

And what about Snap, the nifty little feature that fills half of a Windows 8 screen? That’s been improved as well. Every app in Windows 10 can be dynamically resized in a window, although it remains to be see how well this works in practice.

Windows 10 snap assistMARK HACHMAN

Snap a document to one side of the screen, and Snap Assist will suggest some others.

In Windows 8, apps can be snapped by clicking the Windows key and the left or right arrow, snapping them to the left or right of the screen. That fills half the screen. With Windows 10, up to four apps can be snapped per screen, maximizing your productivity.

What’s neat, though, is that once you snap an app, Windows 10 suggests another, similar app that you might want to snap next to it, from a small collection of windows. The feature is intended to save you the hassle of hunting about through menus to actually construct a virtual desktop. Time will tell whether these suggestions will prove useful, but it’s a good start.

You can see, however, that a number of different features—Snap Assist, windowed apps, virtual desktops—all flow somewhat organically into one another. I’m honestly interested to see what difference they make in my own daily workflow.

Last but not least: Search improvements

Windows 10 also adds a search button to the taskbar, moving the other major functionality of the Windows 8 Start page to the desktop environment. If you’re like me, you really don’t click icons on the Start page any more (or use bookmarks when searching the Web). Instead, “searching” for recent apps or documents is often quicker.

windows10 windows product family 9 30 eventIMAGE: MICROSOFT

Microsoft promises consistent experiences over a variety of form factors and screen sizes.

That approach is also found in Windows 10. Microsoft officials say that Search and File Explorer now displays your recent files and frequently visited folders, making finding files you’ve worked on faster and easier.

Granted, Microsoft’s Windows 10 demonstration was somewhat orchestrated to put its best face forward. But with potentially millions of eager Windows users prepared to bang away on it beginning Wednesday, any flaws will be quickly exposed. What’s refreshing is Microsoft is actually encouraging this, similar to the way in which “developers”—i.e., fans—were encouraged to take its latest Windows Phone builds for a spin.

Love it or hate it? Microsoft wants to know. But I think you’ll quite like Windows 10.

[This article was first published on PCWorld]


Create your first real-time AngularJS application

In my previous article I talked about creating real-time PHP application. That was on the server side and I demonstrated a very very basic client to connect with it. Let’s take that to next step and create a Javascript client with AngularJS.



 css/bootstrap.min.css" rel="stylesheet">
 <script src="angular-client.js"></script>
 body { margin-top: 10px; }
 input.message { height: 30px; }
 <form class="form-inline">
 <button ng-click="connect()" class="btn">Connect</button>
 <input type="text" ng-model="text" placeholder="input message to send" class="message"></input>
 <button ng-click="send()" class="btn">send</button>
 <table class="table table-striped">
 <tr ng-repeat="message in messages">



var app = angular.module('app', []);
app.factory('ChatService', function() {
 var service = {};
 service.connect = function() {
 if( { return; }
 var ws = new WebSocket("ws://localhost:8080");
 ws.onopen = function() {
 service.callback("Succeeded to open a connection");
 ws.onerror = function() {
 service.callback("Failed to open a connection");
 ws.onmessage = function(message) {
 }; = ws;
 service.send = function(message) {;
 service.subscribe = function(callback) {
 service.callback = callback;
 return service;
app.controller('AppCtrl', ['$scope', 'ChatService', function($scope, ChatService) {
 $scope.messages = [];
 ChatService.subscribe(function(message) {
 $scope.connect = function() {
 $scope.send = function() {
 $scope.text = "";


It is pretty straightforward. We created an Angular Service and consumed that in our Angular controller. The only purpose of Angular service is handling communication. It will hand over the message to the subscriber in our case Angular controller and controller can do anything with that message. Here since we demonstrated the chat application so controller displays that message received.

That’s it! so simple.

Note: Both HTML and Javascript files are also available on Gist.

Code was referenced from here.




Create your first real-time PHP application

If you ever wondered if there is a way to write a real-time web application using PHP where any event or message is delivered/pushed to all recipients as they occur, in real-time? Then you are at right place. We’ll be building a sample real-time chat application using PHP and Ratchet and all messages will be pushed to all recipients in real-time. There are other technologies like node.js and but obviously there is a learning curve. If you don’t have time to learn a new thing or just want to stick with PHP then keep reading.


The goal of this application is to write a simple Chat application. Chats in event-driven programming are the “Hello World!” of applications. The chat will accept all incoming messages and deliver that message to all other connections.

The Chat class

Note: This document assumes you are familiar with PSR-0 and Composer. See Installation if you’re not yet familiar with this.

We’re going to hold everything in the MyApp namespace. Your composer file should look something like this:

    "autoload": {
        "psr-0": {
            "MyApp": "src"
    "require": {
        "cboden/ratchet": "0.3.*"

We’ll start off by creating a class. This class will be our chat “application”. This basic application will listen for 4 events:

  • onOpen – Called when a new client has Connected
  • onMessage – Called when a message is received by a Connection
  • onClose – Called when a Connection is closed
  • onError – Called when an error occurs on a Connection

Given those triggers, our class will implement the MessageComponentInterface:

namespace MyApp;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;

class Chat implements MessageComponentInterface {
    public function onOpen(ConnectionInterface $conn) {

    public function onMessage(ConnectionInterface $from, $msg) {

    public function onClose(ConnectionInterface $conn) {

    public function onError(ConnectionInterface $conn, \Exception $e) {

You’ll notice, in addition from just implementing methods from the MessageComponentInterface, we’ve given our application a namespace and are accepting the ConnectionInterfaceclasses. This class, usually implemented by a Connection instance, is a representation of a client’s connection on the other side of the socket. On each of the four triggered events, the client Connection representation is passed. These objects are re-used, you will receive the same Connection sometimes.

Save this as /src/MyApp/Chat.php. We’ll come back to our Chat class soon.


Our Chat class will be our application logic. Next, we’re going to piece together our shell script. This is the script/file we will call from the command line to launch our application.

use Ratchet\Server\IoServer;
use MyApp\Chat;

    require dirname(__DIR__) . '/vendor/autoload.php';

    $server = IoServer::factory(
        new Chat(),


Above, you’ll see we create an I/O (Input/Output) server class. It stores all the established connections, mediates data sent between each client and our Chat application, and catches errors. The new instance of Chat class then wraps the I/O Server class. Finally, we tell the server to enter an event loop, listening for any incoming requests on port 8080.

Save this script as /bin/chat-server.php. Now, we can run it with the following command in your terminal:

$ php bin/chat-server.php

The script should now execute, taking possession of your terminal. You can cancel the script, as we’re not quite finished yet.


So far, we’ve just set up structure, both in our shell script and our Chat class. Now, to add code to our Chat to complete our application.

Let’s add some logic to our Chat class. What we’re going to do, is track all incoming Connections, in order to send them messages. Typically, you would store a collection of items in an array, but we’re going to use something called SplObjectStorage. These storage containers are built to store objects, which is what the incoming Connections are.

namespace MyApp;
use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface;

class Chat implements MessageComponentInterface {
    protected $clients;

    public function __construct() {
        $this->clients = new \SplObjectStorage;

    public function onOpen(ConnectionInterface $conn) {
        // Store the new connection to send messages to later

        echo "New connection! ({$conn->resourceId})\n";

    public function onMessage(ConnectionInterface $from, $msg) {
        $numRecv = count($this->clients) - 1;
        echo sprintf('Connection %d sending message "%s" to %d other connection%s' . "\n"
            , $from->resourceId, $msg, $numRecv, $numRecv == 1 ? '' : 's');

        foreach ($this->clients as $client) {
            if ($from !== $client) {
                // The sender is not the receiver, send to each client connected

    public function onClose(ConnectionInterface $conn) {
        // The connection is closed, remove it, as we can no longer send it messages

        echo "Connection {$conn->resourceId} has disconnected\n";

    public function onError(ConnectionInterface $conn, \Exception $e) {
        echo "An error has occurred: {$e->getMessage()}\n";


Running It

Complete, let’s run it and test it. Open up three terminal windows, typing:

$ php bin/chat-server.php
$ telnet localhost 8080
$ telnet localhost 8080

In each of the telnet windows, type a message (“Hello World!”) and see it appear in the other!

Next Steps

Now that we have a basic working Chat application, let’s make that work in a web browser (Chrome, FireFox, or Safari [for now]). First, let’s go back to our chat-server.php script. We’re going to utilize another component of Ratchet; the WsServer class:

use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use MyApp\Chat;

    require dirname(__DIR__) . '/vendor/autoload.php';

    $server = IoServer::factory(
        new HttpServer(
            new WsServer(
                new Chat()


Run the shell script again, open a couple web browser windows, and open a javascript console or a page with the following javascript:

var conn = new WebSocket('ws://localhost:8080');
conn.onopen = function(e) {
    console.log("Connection established!");

conn.onmessage = function(e) {

Once you see the console message “Connection established!” you can start sending messages to other connected browsers:

conn.send('Hello World!');

This post was extracted from Ratchet documentation.


How can I test if mod_rewrite on my server is enabled and working?

Note that mod_rewrite can only be used with web server Apache. Follow the instructions below to check whether module mod_rewrite is installed and correctly configured on your server.

Create the file .htaccess and add these two lines

RewriteEngine on
RewriteRule ^testing.php$ modrewrite.php

This tells the web server to load modrewrite.php when testing.php is requested.

Create the file modrewrite.php with this line

<?php echo "mod_rewrite works"; ?>

Create the file testing.php with this line

<?php echo "mod_rewrite does not work"; ?>

Now use your web browser to load testing.php. If you see “mod_rewrite works” your server has a working mod_rewrite instance. If you see anything else, including an internal server error, your server is not properly configured for mod rewrite.


Global Variables in AngularJS

I’ve followed the angularjs tutorial and I noticed that I wasn’t able to have global variables.
Turns out to be actually simple but Angular doesn’t mention it.
You will need to edit your app module (app.js )

var app = angular.module('appName',);
//Add this to have access to a global variable ($rootScope) {
    $rootScope.globalVariable = 'Hi, global variabel'; //global variable

Now if you want to use it from your controller

function appNameCtrl($scope, $rootScope){
    $rootScope.globalVariable = 'Modji';

In your view

My name is {{globalVariable}}

If you are using any services like $http in your controller then you have to pass $rootScope as service along with $http.

app.controller('appNameCtrl', ['$http', '$rootScope', function ($scope, $rootScope){
    $rootScope.globalVariable = 'Modji';


To see the example visit my Plunker at

This post is edited and was originally published at Coding Insight.

Android? Too many pattern attempts? Can’t hard reset? Here what to do!

htconexI had pattern screen lock on my HTC One X Android phone. Yesterday my nephew tried to unlock it too many times and it got permanently locked.

Too many pattern attempts

After trying too many attempts phone got locked and asking for my Google username and password. But unfortunately I wasn’t connected to Wifi due to which whenever I enter my login details it says invalid username and/or password. Since it tries to connect to Google server to authenticate and it couldn’t.

Master Reset

OK, since my phone wasn’t asking me for pattern and it wasn’t connected to internet so it was also not able to authenticate my logins. So doing a master/hard reset was the only option left. To hard reset phone you have to power off your phone and then turn on in recovery/bootloader mode. To do this you have to follow these steps.

  1. Press and hold the VOLUME DOWN button, and then press and hold the POWER button.
  2. Wait for the screen with the three Android images to appear, and then release the POWER and VOLUME DOWN buttons.
  3. Press VOLUME DOWN to select FACTORY RESET, and then press the POWER button.

But for this to work the Fast boot option in Settings > Battery Manager must not be selected. Oops! I remember I selected that option so I was out of luck and this didn’t work and my phone keep starting in normal mode leaving me on same login screen.

Big Problem!

So, now I was stuck and there were several problems.

  1. I couldn’t enter my pattern since it wasn’t asking due to too many attempts
  2. It wasn’t connected to Wifi neither my phone data plan so no internet due to which it wasn’t authenticating from Google.
  3. Fast boot was selected so I was unable to restart my phone in recovery mode.

Now what? I tried to Google solution but all I was getting is to go in recovery mode to hard reset my phone to make it reusable and I was unable to do that as well. Then suddenly I found  the solution!

The Solution!

Solution to this was when your phone is switched on and you are on login screen do the following:

  • Press and hold both Volume down button as well as power button until the screen goes completely black.
  • Once it is black release the power button only. Do not release the volume down button.
  • You will be booted into the bootloader mode.

Woala! That’s it! Now you can select Factory reset from the menu and wow finally I made my phone reusable again. :)


Photoshop Color Replacement Tool Tutorial

The Color Replacement Tool is not the most professional way to change colors in an image and won’t always give you the results you need, but it usually works well for simple tasks and it’s such an easy tool to use that it’s worth giving it a try before moving on to more advanced and time consuming methods.

Selecting The Color Replacement Tool

The Color Replacement Tool was first introduced in Photoshop CS, and if you’re using Photoshop CS or CS2, you’ll find the Color Replacement Tool nested under the Healing Brush in the Tools palette. To access it, click and hold your mouse button down on the Healing Brush until a fly-out menu appears, then select the Color Replacement Tool from the menu.

In Photoshop CS3, Adobe changed things around a bit and moved the Color Replacement Tool in with the regular Brush Tool, so if you’re using Photoshop CS3 or CS4 (which is what I’m using here), click and hold your mouse button down on the Brush Tool, then select the Color Replacement Tool from the fly-out menu:

The Color Replacement Tool in Photoshop. Image © 2010 Photoshop

In Photoshop CS3 and CS4, the Color Replacement Tool is nested under the Brush Tool. In CS and CS2, it’s under the Healing Brush.

With the Color Replacement Tool selected, your mouse cursor will change into a circle with a small target symbol in the center of it. As I mentioned, if you’re familiar with the Background Eraser, this will look very familiar to you since both tools use the exact same cursor:

The Color Replacement Tool cursor in Photoshop. Image © 2010 Photoshop

The Color Replacement Tool’s cursor is made up of a simple circle with a target symbol in the middle, just like the Background Eraser.

You can adjust the size of the circle directly from your keyboard using the bracket keys, which are found to the right of the letter P on most keyboards. Press the left bracket key ( [ ) to make the circle smaller or the right bracket key ( ] ) to make it larger. To change the hardness of the brush edges, just add the Shift key. Press Shift+left bracket ( [ ) to make the edges softer or Shift+right bracket ( ] ) to make them harder.

How The Color Replacement Tool Works

As you drag the Color Replacement Tool over your image, Photoshop continuously samples the color that’s directly under the target symbol in the center of the tool’s cursor. This is the color that will be replaced, and it will be replaced with your current Foreground color. Any pixels that fall within the larger circle surrounding the target symbol that match the color being replaced will have their color changed. For example, if you pass the target symbol over an area of blue in your photo and your Foreground color is set to red, any blue pixels that the larger circle passes over will be changed to red. There’s some options we can set in the Options Bar to alter the behavior of the tool (which we’ll look at shortly), but essentially, that’s how it works.

You can see what your Foreground color is currently set to by looking at the Foreground color swatch near the bottom of the Tools palette. By default, it’s set to black:

The Foreground color swatch in Photoshop. Image © 2010 Photoshop

Black is the default Foreground color, but it’s probably not the color you’ll want to use.

To change the Foreground color, simply click directly on the color swatch, then choose a new color from the Color Picker. I’ll choose a green color, just for fun. Click OK to close out of the Color Picker when you’re done:

Photoshop Color Picker. Image © 2010 Photoshop

Use the Color Picker to choose a new Foreground color.

If I look again in my Tools palette, I see that the Foreground color swatch has changed to the new color. If I paint on an image with the Color Replacement Tool at this point, whichever color I drag the target symbol over will be replaced with green:

The Foreground color in Photoshop has been changed. Image © 2010 Photoshop

The newly chosen color appears in the color swatch.

As an example, here’s a photo of a young girl holding a balloon:

A young girl holding a blue balloon. Image © 2010 Photoshop

The girl looks happy, but the balloon looks blue.

She may look happy with her blue balloon, but what she really wanted was a green balloon. As luck would have it, I just happen to have my Foreground color currently set to green, so let’s see what we can do for her. With the Color Replacement Tool selected, I’ll move the target symbol over the blue balloon in the image and click my mouse button. As soon as I click, two things happen. First, Photoshop samples the blue color under the target symbol so it knows which color to replace. Then, any blue pixels that fall within the larger circle surrounding the target symbol immediately change to green, since green is now my Foreground color:

Clicking on the blue balloon with the Color Replacement Tool. Image © 2010 Photoshop

Photoshop samples the blue color and replaces all blue pixels within the circle with green.

To change the rest of the balloon to green, I just need to keep my mouse button held down and continue dragging the Color Replacement Tool over the remaining blue areas. As long as I keep the target symbol over the blue balloon and don’t stray off into other areas of the image, which would cause Photoshop to sample a different color, only the blue color will be replaced with green:

Continuing to paint over the balloon with the Color Replacement Tool. Image © 2010 Photoshop

Keeping the target symbol over the blue area as I paint.

If I accidentally move the target symbol outside of the balloon and over the yellow wall behind it, Photoshop samples the color of the wall and begins changing it to green as well:

Accidentally moving the target symbol over the wrong part of the image. Image © 2010 Photoshop

By moving the target symbol outside of the balloon, Photoshop starts replacing other colors with green.

If this happens, simply undo the last step by pressing Ctrl+Z (Win) / Command+Z (Mac), or undo multiple steps by pressing Ctrl+Alt+Z (Win) / Command+Option+Z (Mac) as many times as needed, then continue on.


Everything seems to be going smoothly as I paint over the balloon until I get to the edges. If you look closely, you can see some faint blue fringing that the Color Replacement Tool is having trouble with:

Blue fringing appears along the edges of the balloon. Image © 2010 Photoshop

Some of the original blue color remains along the edges of the balloon.

I mentioned a few moments ago that there are several options available to us in the Options Bar for altering the behavior of the Color Replacement Tool, and one of these options is Tolerance. The Tolerance setting determines how different a color can be from the sampled color for Photoshop to replace it with the Foreground color. The default value is 30%, which is a good starting point. Unfortunately, it’s not quite high enough in this case for Photoshop to be able to include the shade of blue right along the edges of the balloon.

I’ll increase my Tolerance value to 50%, which will allow the Color Replacement Tool to affect a wider range of colors:

The Tolerance option for the Color Replacement Tool. Image © 2010 Photoshop

Increasing the Tolerance setting in the Options Bar.

With a higher Tolerance value entered, I’ll undo my last step and try again. This time, as I move along the edge of the balloon, the Color Replacement Tool is able to remove the blue fringing:

Painting with the Color Replacement Tool using a higher Tolerance value. Image © 2010 Photoshop

The blue along the edge of the balloon has been successfully changed to green.

I’ll finish painting over the remaining areas as our once blue balloon is magically transformed into green thanks to the Color Replacement Tool and a little boost in the Tolerance value:

The girl is now holding a green balloon. Image © 2010 Photoshop

The Color Replacement Tool was able to change the balloon’s color with little effort.

Sampling Colors From The Image
In the above example, I randomly chose a new color for the balloon from Photoshop’s Color Picker, but I could just as easily have selected a color directly from the photo itself. To do that, with the Color Replacement Tool active, hold down your Alt (Win) / Option (Mac) key, which will temporarily switch you to the Eyedropper Tool (you’ll see your cursor change into an eyedropper). Click on an area of the photo that contains the color you want to use. Photoshop will sample that color and make it your Foreground color. I’ll click on the pinkish-red top she’s wearing:

Using the Eyedropper Tool in Photoshop to sample a color from the image. Image © 2010 Photoshop

Hold down Alt (Win) / Option (Mac) and click on an area of the photo to sample a color.

If I look at the Foreground color swatch in the Tools palette, I see that the color I clicked on has become my Foreground color:

The Foreground color swatch in the Tools palette displays the sampled color. Image © 2010 Photoshop

The sampled color appears in the Foreground color swatch.

With the color sampled directly from the image, I can paint over the balloon once again with the Color Replacement Tool to change its color:

Coloring the balloon red with the Color Replacement Tool in Photoshop. Image © 2010 Photoshop

The green balloon, originally blue, is now red.

Notice that even though we’ve essentially painted a color over top of the balloon, it retained its shiny, reflective appearance. If we had simply grabbed the regular Brush Tool and painted over it, the balloon would look like nothing more than a flat surface with no life to it. So how was the Color Replacement Tool able to keep the balloon’s texture and reflections? For the answer to that, we need to look at more of the options in the Options Bar, which we’ll do next!

The Blend Modes

The reason the Color Replacement Tool is able to paint a new color over an object or an area of a photo without losing the texture detail is because it uses blend modes to blend the new color in with the image. There’s four blend modes to choose from (Hue, Saturation, Color, and Luminosity), all of which can be selected from the Modeoption in the Options Bar. The default blend mode is Color:

The blend modes for the Color Replacement Tool. Image © 2010 Photoshop

The Mode option allows us to change the blend mode for the Color Replacement Tool.

If you’ve ever taken a Color Theory 101 class, you probably know that what most of us think of as the color of an object is really a combination of three things – huesaturation and brightness. Each of the four blend modes we can select for the Color Replacement Tool will change which of these three aspects of the original color will be affected.

Hue: The Hue blend mode will change only the basic color itself. It will not change the saturation or brightness of the original color. This mode is useful for images where the colors are not very intense and will usually produce very subtle changes.

Saturation: The Saturation blend mode changes only the saturation of the original color. The hue and brightness are not affected. This is useful for reducing the intensity of a color, or even removing color completely.

Color: Color is the default blend mode and will change both the hue and saturation. The brightness will remain unchanged. This is the blend mode you’ll use most often.

Luminosity: Finally, the Luminosity blend mode will simply match the brightness of the original color to the brightness of the new color. Hue and saturation are unaffected.

In this photo below, an orange balloon seems ready to split from the group and fly off on its own adventure into the sky:

A photo of balloons. Image licensed from iStockphoto by Photoshop

The original image.

One way to make the balloon stand out even more from the others in the image might be to reduce the color saturation of some of the other balloons below it. I don’t want to change the actual color of the balloons, just the intensity of them. To do that, with the Color Replacement Tool selected, I’ll change my blend mode option in the Options Bar to Saturation:

Changing the blend mode for the Color Replacement Tool to Saturation. Image © 2010 Photoshop

Changing the blend mode to Saturation.

If I wanted to completely desaturate the balloons, removing their color entirely, I’d set my Foreground color to either black, white or any shade of gray, but since I want a more subtle effect, I’ll just sample one of the less saturated colors in the image by holding down my Alt (Win) / Option (Mac) key to temporarily switch to the Eyedropper Tool, then I’ll click on the color I want. I’ll choose a less saturated yellow. The color itself makes no difference since the Saturation blend mode won’t change any of the original colors. It will only affect the saturation:

Sampling a color from one of the balloons in the photo. Image © 2010 Photoshop

Sampling one of the less saturated colors in the image.

With a less saturated color now set as my Foreground color and my blend mode set to Saturation, I’ll simply paint over any balloons that need their saturation level reduced, adjusting my brush size with the left and right bracket keys on the keyboard and changing the Tolerance value in the Options Bar as needed. Here, we can see the difference in color saturation as I paint over one of the other orange balloons:

Reducing the color saturation with the Color Replacement Tool. Image © 2010 Photoshop

Reducing the color saturation of one of the balloons by painting over it in Saturation mode.

I’ll continue painting over any other balloons that need their color saturation reduced. Here’s the completed result:

The balloons after reducing their color saturation. Image © 2010 Photoshop

The orange balloon floating above the others now stands out even more thanks to its higher color saturation.

The Brightness Problem

There’s one situation, unfortunately, where the Color Replacement Tool tends to fail miserably, and that’s when there’s a big difference in brightness between the original color in the image and the color you want to replace it with. Let’s say I wanted to replace the orange in that one balloon we’ve been focusing on with the dark purple color from one of the other balloons. From everything we’ve seen so far, it should be simple enough, right?

First, I’ll set the colors in the image back to what they were originally by going up to the File menu at the top of the screen and choosing the Revert command. Then, with the Color Replacement Tool selected, I’ll hold down my Alt (Win) / Option (Mac) key and click on one of the purple balloons to sample the color:

Sampling a purple color from the image. Image © 2010 Photoshop

Sampling a purple color to set as my Foreground color.

I’ll set my blend mode in the Options Bar back to Color, the default setting. Then, I’ll paint over the orange balloon to change its color to dark purple. Here’s the result:

The orange balloon is now a light purple balloon. Image © 2010 Photoshop

Something’s not quite right.

Hmm. It’s definitely purple, but it doesn’t quite look like the other purple balloons, does it? The problem is that it’s much lighter than the other purple balloons, and that’s because the original color of the balloon was much lighter than the dark purple color I sampled. The Color blend mode had no effect on the brightness. In fact, the only blend mode that does change the brightness is Luminosity, so let’s try that one. I’ll change my blend mode in the Options Bar to Luminosity:

Changing the blend mode for the Color Replacement Tool to Luminosity. Image © 2010 Photoshop

The Luminosity blend mode matches the brightness of the original color to the brightness of the new color.

I’ll undo my steps to change the balloon back to its original orange color, and then, with my blend mode set to Luminosity this time, I’ll try replacing the orange with dark purple:

The image after painting over the balloon with the blend mode set to Luminosity. Image © 2010 Photoshop

Suddenly the light purple didn’t look so bad.

I think it’s safe to say that things did not go well. The Luminosity blend mode definitely made the balloon darker, but it’s still orange, and now most of the texture detail is gone! It barely looks like a balloon at all at this point, and this is the problem we face with the Color Replacement Tool. It works great for simple tasks where you only need to change the hue and/or saturation of a color, but if there’s too much of a difference in brightness values between the original color and the new color, you’ll probably want to try something else.

Sampling Options

Directly to the right of the blend mode option in the Options Bar is a row of three small icons. Each of these icons represents a different sampling option for the Color Replacement Tool, and they work exactly the same here as they do for Photoshop’s Background Eraser. From left to right, we have Continuous (the default setting), Onceand Background Swatch. Simply click on the icons to switch between them as needed:

The three sampling options for the Color Replacement Tool. Image © 2010 Photoshop

From left to right – the Continuous, Once and Background Swatch sampling options.

These sampling options control how Photoshop samples colors in the image as you move the target symbol over them, or if it samples them at all. With Continuous selected, Photoshop continually looks for new colors to replace as you drag the Color Replacement Tool around. Any new color the target symbol passes over becomes the new color to replace. This is the setting you’ll use most often and works best when there’s a lot of variation in the color of the object.

With Once selected, Photoshop will only sample the color you initially click on regardless of how many other colors you drag over (as long as you keep your mouse button held down). This option works best if you’re replacing a large area of solid color. You can also try the Once option if you find that Continuous is causing the Color Replacement Tool to bleed into other nearby areas and the Tolerance option doesn’t seem to help.

Finally, you won’t use it very often (if ever), but the Background Swatch setting will replace whatever color is currently set as your Background color. This option may prove useful if neither of the other two sampling options is working for you. Click on the Background color swatch in the Tools palette and select a color from the Color Picker that matches, as close as possible, the color in the image you want to replace. Try adjusting the Tolerance value if the color you chose wasn’t quite close enough.

The Background color swatch in the Tools palette. Image © 2010 Photoshop

The Background Swatch sampling option will replace the Background color with the Foreground color.


Another option that works exactly the same with the Color Replacement Tool as it does with the Background Eraser is Limits, which controls where Photoshop can look for colors to replace. The three choices are Contiguous,Discontiguous and Find Edges. Of the three, you’ll really only ever use the first two:

The three Limits options for the Color Replacement Tool. Image © 2010 Photoshop

The Limits option.

The default setting for the Limits option is Contiguous, which means that the Color Replacement Tool can only change the color of pixels in the area the target symbol in the center of the cursor is touching. It won’t affect pixels that match the sampled color but are separated from the target symbol by an area of a different color unless you physically move the target symbol into the new area. The opposite of this is Discontiguous, which allows the Color Replacement Tool to replace the color of any pixels that match the sampled color and fall within the boundaries of the cursor, whether those pixels are in the same area as the target symbol or not.


The final option for the Color Replacement Tool is Anti-alias, which is selected by default:

The Anti-Aliasing option for the Color Replacement Tool. Image © 2010 Photoshop

The Anti-alias option.

Keep this option selected to smooth out the edges around the areas the Color Replacement Tool is affecting.

And there we have it!

Originally published at Photoshop Essentials.