# Create a Custom Skin from an Existing One

## Abstract

Each of the controls included in the Telerik® UI for ASP.NET AJAX suite is styled with two css files that are loaded in a certain order. The first one - ControlName.css, also called **base stylesheet** contains CSS properties and values that are common for all skins, i.e it is layout-specific, not skin-specific. These are CSS float, padding, margin, font-size, font-family, etc. In the general case, when creating a custom skin for a control this file should not be edited, unless the custom skin needs different sizes, paddings or margins.

The second file represents the actual skin of the control, and its name consists of the control name plus the skin name, i.e - Rotator.Default.css. Upon creating a custom skin for the control, one should edit that particular file, as it contains skin-specific CSS properties, and references to images, colors, borders and backgrounds.

## Creating a Custom Skin for RadRotator for ASP.NET AJAX from an Existing One

### Getting and Renaming Files and CSS Classes

In order to explain better the CSS classes of RadRotator, we will use both Rotator.css and Rotator.SkinName.css as external resources. We will modify an existing skin of RadRotator. Follow these steps to register an external skin for RadRotator for ASP.NET AJAX before editing any CSS:

1. In your project, create a new directory named **Skins**

2. In the skins folder create a new directory **MyCustomSkin**.

3. Go to **\~/\[TelerikControlsInstallationFolder]/Skins** and copy **Rotator.css** in your **Skins** folder

4. Go to **\~/\[TelerikControlsInstallationFolder]/Skins/Default** and copy **Rotator.Default.css** and the **Skins/Default/Rotator** folder in your **Skins** folder.

5. Rename Rotator.**Default**.css to Rotator.**MyCustomSkin**.css and the folder **Default** to **MyCustomSkin**.

6. When you are finished you should have: Skins/Rotator.css, Skins/MyCustomSkin/Rotator.MyCustomSkin.css and Skins/MyCustomSkin/Rotator. The last folder contains the images for MyCustomSkin.

7. In order to support multiple skins of RadRotator on a single page, the wrapping skin-specific class is coined by the name of the control, RadRotator plus underscore ("\_") plus SkinName, i.e **.RadRotator_Default**, so in order to create a custom skin out of the Default skin, we should rename all occurences of "**Default**" in Rotator.MyCustomSkin.css to "**MyCustomSkin**" as shown below:

   ![Rotator CSS Classes Batch Rename](https://www.telerik.com/products/aspnet-ajax/documentation/assets/6ffd4ff1c22766674a5a6b78c0f02e38/rotator-cssclassesbatchrename.gif)

8. Put a new server declaration of RadRotator on your page, and set **Skin="MyCustomSkin", EnableEmbeddedSkins="false"** and **EnableEmbeddedBasestylesheet="false"**:

   ```ASP.NET
   <telerik:RadRotator RenderMode="Lightweight" ID="RadRotator1" runat="server" Skin="MyCustomSkin" EnableEmbeddedSkins="false"
   	EnableEmbeddedBaseStylesheet="false">
   </telerik:RadRotator>
   ```

9. Register Rotator.css and Rotator.MyCustomSkin.css in the <head>...</head> section of your web page. In order to have the CSS applied correctly, the base stylesheet should come first in the DOM:

   ```ASP.NET
   <link rel="stylesheet" type="text/css" href="Skins/Rotator.css"></link>
   <link rel="stylesheet" type="text/css" href="Skins/MyCustomSkin/Rotator.MyCustomSkin.css"></link>
   ```

   Make sure the path to the files is correct, otherwise the skin will not apply.

10. Reload the page, and if the steps 0-9 have been followed correctly, you will see RadRotator running a custom Default skin set as an external resource.

### Explanation of the CSS Classes in Rotator.css and Rotator.MyCustomSkin.css

#### The Base Stylesheet - Rotator.css

**Main CSS Classes**

* **.RadRotator** - primary wrapping class of RadRotator

* **.rrRelativeWrapper** - secondary wrapping class of RadRotator

* **.rrClipRegion** - the wrapping class of RadRotator's items list

* **.rrClipRegion .rrItemsList** - RadRotator's items list

* **.rrClipRegion .rrItemsList li** - single item in RadRotator's items list

* **.RadRotator ul.rrVerticalList** - vertical list of RadRotator's items

* **.RadRotator .rrVerticalList li** - single list of vertical list of RadRotator's items

* **.rrButton** - scroll button

* .**rrButton:hover** - scroll button hovered state

* **.rrButton.rrButtonUp** - scroll up button

* **.rrButton.rrButtonRight** - scroll right button

* **.rrButton.rrButtonDown** - scroll down button

* **.rrButton.rrButtonLeft** - scroll left button

* **.rrButton.rrButtonDisabled** - disabled scroll button in which the disabled appearance is achieved with opacity

* **.rrNoBorder .rrClipRegion** - - the wrapping class of RadRotator's items list in no-bordered RadRotator

* **html* .rrVerticalList li*\* - special setting for RadRotator's vertical list for Internet Explorer 6

#### The Skin Stylesheet - Rotator.MyCustomSkin.css

Each skin of RadRotator consists of an [image sprite](http://www.alistapart.com/articles/sprites/), that is contained in the Skins/SkinName/Rotator folder:

1. RotatorButtons.gif - the normal and hover states of the buttons:

   ![Rotator Scroll Buttons Sprite Images](https://www.telerik.com/products/aspnet-ajax/documentation/assets/39dc7e2f50be77b032f2e6783cd8142d/rotator-rotatorbuttons.gif)

   Each button is a 20 x 20 pixels square. On the left row is the normal state of the buttons, on the second - the hovered state. In the CSS they are selected from the sprite via the [background-position](https://www.w3schools.com/cssref/pr_background-position.asp) property.

2. CSS Classes that are used in in **The Skin Stylesheet - Rotator.SkinName.css:**

   * **.RadRotator_Default .rrClipRegion** - the wrapping class of RadRotator's items list

   * **.RadRotator_Default .rrClipRegion .rrItemsList** - RadRotator's items list

   * **.RadRotator_Default .rrButton** - RadRotator button

   * **.RadRotator_Default .rrButton.rrButtonUp** - scroll up button

   * **.RadRotator_Default .rrButton.rrButtonUp:hover** - hovered scroll up button

   * **.RadRotator_Default .rrButton.rrButtonRight** - scroll right button

   * **.RadRotator_Default .rrButton.rrButtonRight:hover** - hovered scroll right button

   * **.RadRotator_Default .rrButton.rrButtonDown** - scroll down button

   * **.RadRotator_Default .rrButton.rrButtonDown:hover** - hovered scroll down button

   * **.RadRotator_Default .rrButton.rrButtonLeft** - scroll left button

   * **.RadRotator_Default .rrButton.rrButtonLeft:hover** - hovered scroll left button

   * **.RadRotator_Default .rrButton.rrButtonDisabled** - disabled scroll button in which the disabled appearance is achieved with opacity

### Understanding the Image Sprite

Below is a visual schemes of the image sprites that are used to skin RadRotator.

RotatorButtons.gif

![RadRotator Button Sprite](https://www.telerik.com/products/aspnet-ajax/documentation/assets/4f8164807e51f39b81d07ef124e83879/rotator-scrollbuttons.gif)

### Modifying the Image Sprite to Achieve Totally New Looks for the Skin

Explained below is a simple method for modifying the image sprite of RadRotator's buttons with [Adobe© PhotoShop](http://adobe.com/) to achieve new looks without creating a new design.

1. Drag RotatorButtons.gif in [Adobe© PhotoShop](http://adobe.com/)

2. From the menu bar select **Image » Mode » RGB Color** to prepare the image for editing (convert from optimized **Indexed Color** to **RGB Color**):

   ![Convert from Indexed to RGB Color](https://www.telerik.com/products/aspnet-ajax/documentation/assets/f85bd423c9994ed41f59d9a57cfcca03/rotator-indexedtorgb.gif)

3. Press **Set Foreground Color** in PhotoShop's toolbox to invoke the color picker dialog:

   ![Adobe PhotoShop Toolbox](https://www.telerik.com/products/aspnet-ajax/documentation/assets/ab5302668d0c175c660d731601332d28/rotator-presstoolbox.gif)

4. Select a color that you like from the color dialog and then close it:

   ![Adobe PhotoShop ColorPicker](https://www.telerik.com/products/aspnet-ajax/documentation/assets/264b5fa680f056672a21d58607692b6a/rotator-colorpicker.gif)

5. Choose the first image you will modify, for example WindowHorizontalSprites.gif, and select **Image » Adjustments Hue » / Saturation to open the Hue / Saturation** dialog of [Adobe© PhotoShop](http://adobe.com/):

   ![Choose Hue and Saturation](https://www.telerik.com/products/aspnet-ajax/documentation/assets/be0005b1534358f2dee82f7c00b36663/rotator-choosehue.gif)

6. Check the **colorize** checkbox in the Hue / Saturation dialog, and the image you have selected will be immediately colorized in the hue you have selected from the toolbox:

   ![Colorize](https://www.telerik.com/products/aspnet-ajax/documentation/assets/86edea6d04a4ba101dc6856497f1a4ba/rotator-colorize.gif)

   You may then play with the Hue, Saturation and Lightness sliders to fine tune or further modify the image. Make sure you memorize the values of the sliders, as you will need to add the same settings to all three images in order to achieve consistent looks

7. Press "OK" when you are finished

8. Select Image **Image » Mode » Indexed Color** to flatten the layers of the image

9. Save and close the image

10. Repeat Steps 5 - 9 for each of the remaining images

11. After you are over and done with this, save your work and reload the page. You will have a brand new skin based on [Telerik](https://www.telerik.com/)'s Default skin of RadRotator.

    ![RadRotator Before](https://www.telerik.com/products/aspnet-ajax/documentation/assets/74126356916f63779f41b5e2017acba5/rotator-rotatorbefore.gif)

    ![RadRotator After](https://www.telerik.com/products/aspnet-ajax/documentation/assets/c8b4f0cf7d6c7546ce2724d3c3fa63e9/rotator-rotatorafter.gif)
