diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index f20c54c06..6edb9e254 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -19,6 +19,7 @@ Picocli follows [semantic versioning](http://semver.org/).
## New and Noteworthy
## Fixed issues
+* [#1184] API: Added public methods `Help.Layout::colorScheme`, `Help.Layout::textTable`, `Help.Layout::optionRenderer`, and `Help.Layout::parameterRenderer`.
* [#1225] Bugfix: Error message for unmatched positional argument reports incorrect index when value equals a previously matched argument. Thanks to [Vitaly Shukela](https://github.com/vi) for raising this.
* [#1215] DOC: User manual improvements, including more tabs with Kotlin source code. Thanks to [Andreas Deininger](https://github.com/deining) for the pull request.
* [#1219] DOC: User manual improvements: added more tabs with Kotlin code. Thanks to [Andreas Deininger](https://github.com/deining) for the pull request.
diff --git a/src/main/java/picocli/CommandLine.java b/src/main/java/picocli/CommandLine.java
index b23e65faf..c9d1bc839 100644
--- a/src/main/java/picocli/CommandLine.java
+++ b/src/main/java/picocli/CommandLine.java
@@ -15619,6 +15619,18 @@ public void addPositionalParameter(PositionalParamSpec param, IParamLabelRendere
}
/** Returns the section of the usage help message accumulated in the TextTable owned by this layout. */
@Override public String toString() { return table.toString(); }
+ /** Returns the ColorScheme used to create Text objects in this layout.
+ * @since 4.6 */
+ public ColorScheme colorScheme() { return colorScheme; }
+ /** Returns the TextTable used in this layout.
+ * @since 4.6 */
+ public TextTable textTable() { return table; }
+ /** Returns the IOptionRenderer used to render options to Text before adding this text to the TextTable in this layout.
+ * @since 4.6 */
+ public IOptionRenderer optionRenderer() { return optionRenderer; }
+ /** Returns the IParameterRenderer used to render positional params to Text before adding this text to the TextTable in this layout.
+ * @since 4.6 */
+ public IParameterRenderer parameterRenderer() { return parameterRenderer; }
}
/** Sorts short strings before longer strings. */
static class ShortestFirst implements Comparator {
diff --git a/src/test/java/picocli/HelpTest.java b/src/test/java/picocli/HelpTest.java
index f5175011b..d00806f1e 100644
--- a/src/test/java/picocli/HelpTest.java
+++ b/src/test/java/picocli/HelpTest.java
@@ -2478,6 +2478,25 @@ public void testUsageNestedSubcommand() throws IOException {
" sub22sub1%n"), sub22);
}
+ @Test
+ public void testLayoutGetters() {
+ ColorScheme colorScheme = new ColorScheme.Builder().build();
+ TextTable table = TextTable.forDefaultColumns(colorScheme, 20, 80);
+ Help.IOptionRenderer optionRenderer = Help.createMinimalOptionRenderer();
+ Help.IParameterRenderer paramRenderer = Help.createMinimalParameterRenderer();
+ Help.Layout layout = new Help.Layout(colorScheme, table, optionRenderer, paramRenderer);
+
+ assertSame(colorScheme, layout.colorScheme());
+ assertSame(table, layout.textTable());
+ assertSame(optionRenderer, layout.optionRenderer());
+ assertSame(paramRenderer, layout.parameterRenderer());
+
+ assertSame(layout.colorScheme, layout.colorScheme());
+ assertSame(layout.table, layout.textTable());
+ assertSame(layout.optionRenderer, layout.optionRenderer());
+ assertSame(layout.parameterRenderer, layout.parameterRenderer());
+ }
+
@SuppressWarnings("deprecation")
@Test
public void testLayoutConstructorCreatesDefaultColumns() {