tools/lib/Term/Fabulous/Screenshot/Theme.pm

filter: Statementstmt 44.2% 46 / 104 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 18.7% 6 / 32 Podpod 100% 26 / 26 totaltotal 48.1% 78 / 162 CC 1 SCAR 2.2
CC
1
Cov
44%
layout
1.7
cell_width
1.3
cell_height
1.3
CRAP 1.2
« blib/lib/Term/Fabulous/Chart/Scale.pm ↑ Summary blib/lib/Term/Fabulous/Widget/Element.pm »
1 package Term::Fabulous::Screenshot::Theme;
2  
3 1 ▶use v5.32;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use feature 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶no warnings 'experimental::signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Object::Pad 0.825;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 class Term::Fabulous::Screenshot::Theme :strict(params) {
11 1 ▶ use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 # The terminal: cell size and font, in image units (pixels at scale 1).
14 0 field $cell_width :param :reader = 9;
15 0 ▶ field $cell_height :param :reader = 18;
Subroutine cell_width: not called CC=1 SCAR=2.6
Pod documented
16 0 ▶ field $font_size :param :reader = 15;
Subroutine cell_height: not called CC=1 SCAR=2.6
Pod documented
17 0 ▶ field $baseline :param :reader = 14; # from the top of a cell
Subroutine font_size: not called CC=1 SCAR=2.6
Pod documented
18 0 ▶ field $line_thickness :param :reader = 1; # of light box drawing lines
Subroutine baseline: not called CC=1 SCAR=2.6
Pod documented
19  
20 # The colors the terminal shows where a program sets none.
21 0 ▶ field $default_foreground :param :reader = 0xD4D8E0;
Subroutine line_thickness: not called CC=1 SCAR=2.6
Pod documented
22 0 ▶ field $default_background :param :reader = 0x161622;
Subroutine default_foreground: not called CC=1 SCAR=2.6
Pod documented
23  
24 # The window around the terminal.
25 0 ▶ field $margin :param :reader = 16; # room for the shadow
Subroutine default_background: not called CC=1 SCAR=2.6
Pod documented
26 0 ▶ field $corner_radius :param :reader = 10;
Subroutine margin: not called CC=1 SCAR=2.6
Pod documented
27 0 ▶ field $title_bar_height :param :reader = 34;
Subroutine corner_radius: not called CC=1 SCAR=2.6
Pod documented
28 0 ▶ field $padding_x :param :reader = 14;
Subroutine title_bar_height: not called CC=1 SCAR=2.6
Pod documented
29 0 ▶ field $padding_top :param :reader = 10;
Subroutine padding_x: not called CC=1 SCAR=2.6
Pod documented
30 0 ▶ field $padding_bottom :param :reader = 14;
Subroutine padding_top: not called CC=1 SCAR=2.6
Pod documented
31 0 ▶ field $title_bar_color :param :reader = 0x1F2430;
Subroutine padding_bottom: not called CC=1 SCAR=2.6
Pod documented
32 0 ▶ field $title_color :param :reader = 0x9AA3B5;
Subroutine title_bar_color: not called CC=1 SCAR=2.6
Pod documented
33 0 ▶ field $title_font_size :param :reader = 13;
Subroutine title_color: not called CC=1 SCAR=2.6
Pod documented
34 0 ▶ field $outline_color :param :reader = 0xFFFFFF;
Subroutine title_font_size: not called CC=1 SCAR=2.6
Pod documented
35 0 ▶ field $outline_opacity :param :reader = 0.08;
Subroutine outline_color: not called CC=1 SCAR=2.6
Pod documented
36 0 ▶ field $shadow_opacity :param :reader = 0.3;
Subroutine outline_opacity: not called CC=1 SCAR=2.6
Pod documented
37 0 ▶ field $shadow_blur :param :reader = 5;
Subroutine shadow_opacity: not called CC=1 SCAR=2.6
Pod documented
38 0 ▶ field $shadow_offset :param :reader = 3;
Subroutine shadow_blur: not called CC=1 SCAR=2.6
Pod documented
39 0 ▶ field $button_colors :param :reader = [ 0xFF5F57, 0xFEBC2E, 0x28C840 ]; # close, minimize, zoom
Subroutine shadow_offset: not called CC=1 SCAR=2.6
Pod documented
40 0 ▶ field $button_radius :param :reader = 6;
Subroutine button_colors: not called CC=1 SCAR=2.6
Pod documented
41 0 ▶ field $button_spacing :param :reader = 20;
Subroutine button_radius: not called CC=1 SCAR=2.6
Pod documented
42  
43 # Fonts tried in order by SVG viewers; any monospace font works, since
44 # the renderer places every cell itself.
45 0 ▶ field $font_family :param :reader = q{'JetBrains Mono', 'Cascadia Mono', 'SF Mono', Menlo, Consolas, 'DejaVu Sans Mono', 'Liberation Mono', monospace};
Subroutine button_spacing: not called CC=1 SCAR=2.6
Pod documented
46  
47 0 ▶ ADJUST {
Subroutine font_family: not called CC=1 SCAR=1.2
Pod documented
48 foreach my $size ( $cell_width, $cell_height, $line_thickness ) {
49 croak "Term::Fabulous::Screenshot::Theme: cell sizes and the line thickness must be positive whole numbers, got '$size'"
50 unless $size =~ /\A[1-9][0-9]*\z/;
51 }
52 }
53  
54 # Where the parts of the window go, for a terminal of the given size.
55 0 ▶ method layout ( $columns, $rows ) {
Subroutine layout: not called CC=1 SCAR=5.3
Pod documented
56 0 my $window_width = $columns * $cell_width + 2 * $padding_x;
57 0 my $window_height = $title_bar_height + $padding_top + $rows * $cell_height + $padding_bottom;
58 return {
59 0 image_width => $window_width + 2 * $margin,
60 image_height => $window_height + 2 * $margin + $shadow_offset,
61 window_x => $margin,
62 window_y => $margin,
63 window_width => $window_width,
64 window_height => $window_height,
65 terminal_x => $margin + $padding_x,
66 terminal_y => $margin + $title_bar_height + $padding_top,
67 };
68 1 }
69 }
70  
71 1 1;
72  
73 __END__
« blib/lib/Term/Fabulous/Chart/Scale.pm ↑ Summary blib/lib/Term/Fabulous/Widget/Element.pm »