Here is a Conditional Formatting example where we add a ThreeColorScale rule. Let's start with how the result will look like:

Here is how this rule will look like when edited in Excel:

And here is the code to achieve it with EPPlus:

```csharp
// Add TwoColorScale conditional formatting to visualize temperatures
// ColorTranslator is a utility from System.Drawing.Primitives.
var cfRule = sheet.ConditionalFormatting.AddThreeColorScale(sheet.Cells["B2:G11"]);
cfRule.LowValue.Color = ColorTranslator.FromHtml("#FF63BE7B");
cfRule.MiddleValue.Color = ColorTranslator.FromHtml("#FFFFEB84");
cfRule.MiddleValue.Type = eExcelConditionalFormattingValueObjectType.Percentile;
cfRule.MiddleValue.Value = 50;
cfRule.HighValue.Color = ColorTranslator.FromHtml("#FFF8696B");
```

```vbnet
' Add TwoColorScale conditional formatting to visualize temperatures
' ColorTranslator is a utility from System.Drawing.Primitives.
Dim cfRule = sheet.ConditionalFormatting.AddThreeColorScale(sheet.Cells("B2:G11"))
cfRule.LowValue.Color = ColorTranslator.FromHtml("#FF63BE7B")
cfRule.MiddleValue.Color = ColorTranslator.FromHtml("#FFFFEB84")
cfRule.MiddleValue.Type = eExcelConditionalFormattingValueObjectType.Percentile
cfRule.MiddleValue.Value = 50
cfRule.HighValue.Color = ColorTranslator.FromHtml("#FFF8696B")
```

---

[Back to Conditional Formatting](<https://epplussoftware.com/docs/styling/conditional-formatting/index.md>)
