Skip to content

Commit b0d134e

Browse files
authored
Merge pull request #164 from posit-dev/feat-fmt-image-circle
Adds new feature: `gt_fmt_img_circle()`, written by @jrycw.
2 parents 40b52a9 + b50b3f8 commit b0d134e

File tree

7 files changed

+585
-4
lines changed

7 files changed

+585
-4
lines changed

docs/_quarto.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ quartodoc:
9393
- fa_icon_repeat
9494
- gt_fa_rank_change
9595
- gt_fa_rating
96+
- gt_fmt_img_circle
9697
- img_header
9798

9899
- title: Utilities

docs/examples/index.qmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,11 @@ addEventListener('resize', setTableWidths);
293293
[gt_fa_rating](./with-code.html#gt_fa_rating){.embed-hover-overlay}
294294
:::
295295

296+
:::{.masonry-item style="--width: 304;"}
297+
{{< embed with-code.qmd#gt_fmt_img_circle >}}
298+
[gt_fmt_img_circle](./with-code.html#gt_fmt_img_circle){.embed-hover-overlay}
299+
:::
300+
296301
:::{.masonry-item style="--width: 355;"}
297302
{{< embed with-code.qmd#img_header >}}
298303
[img_header](./with-code.html#img_header){.embed-hover-overlay}

docs/examples/with-code.qmd

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -978,6 +978,29 @@ gt.pipe(gte.gt_fa_rating, columns="rating", name="star")
978978
```
979979
{{< include ./_show-last.qmd >}}
980980

981+
### [gt_fmt_img_circle](https://posit-dev.github.io/gt-extras/reference/gt_fmt_img_circle.html){title="Click for reference"}
982+
```{python}
983+
# | label: gt_fmt_img_circle
984+
import polars as pl
985+
from great_tables import GT
986+
import gt_extras as gte
987+
988+
rich_avatar = "https://avatars.githubusercontent.com/u/5612024?v=4"
989+
michael_avatar = "https://avatars.githubusercontent.com/u/2574498?v=4"
990+
jules_avatar = "https://avatars.githubusercontent.com/u/54960783?v=4"
991+
992+
993+
df = pl.DataFrame({"@machow": [michael_avatar], "@rich-iannone": [rich_avatar], "@juleswg23": [jules_avatar]})
994+
995+
(
996+
GT(df)
997+
.cols_align("center")
998+
.opt_stylize(color="green", style=6)
999+
.pipe(gte.gt_fmt_img_circle, height=80)
1000+
)
1001+
```
1002+
{{< include ./_show-last.qmd >}}
1003+
9811004
### [img_header](https://posit-dev.github.io/gt-extras/reference/img_header.html){title="Click for reference"}
9821005
```{python}
9831006
# | label: img_header

gt_extras/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from .formatting import fmt_pct_extra, gt_duplicate_column, gt_two_column_layout
1010
from .html import gt_merge_stack, with_hyperlink, with_tooltip
1111
from .icons import fa_icon_repeat, gt_fa_rank_change, gt_fa_rating
12-
from .images import add_text_img, img_header
12+
from .images import add_text_img, gt_fmt_img_circle, img_header
1313
from .plotting import (
1414
gt_plt_bar,
1515
gt_plt_bar_pct,
@@ -68,6 +68,7 @@
6868
"gt_two_column_layout",
6969
"add_text_img",
7070
"img_header",
71+
"gt_fmt_img_circle",
7172
"gt_add_divider",
7273
"gt_plt_summary",
7374
]

0 commit comments

Comments
 (0)