Three color scale example - DON-PHAM/EPPlus GitHub Wiki
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:
// 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");