Home>PHP source code>Other categories

style()

The style() function may be used to add own custom styles and also update colors.

Click me
');">
use function Termwind{style};

style('green-300')->color('#bada55');
style('btn')->apply('p-4 bg-green-300 text-white');

render('
Click me
'
);

ask()

The ask() function may be used to prompt the user with a question.

What is your name? HTML);">
use function Termwind{ask};

$answer = ask(<<
    
        What is your name?
    
HTML);

The return provided from the ask method will be the answer provided from the user.

terminal()

The terminal() function returns an instance of the Terminal class, with the following methods:

Classes Supported

All the classes supported use exactly the same logic that is available on tailwindcss.com/docs.

Responsive Design

Like TailwindCSS we also support Responsive Design media queries and this are the breakpoints supported:

If bg is blue is sm, if red > than sm breakpoint.
HTML);">
render(<<<'HTML'
    
If bg is blue is sm, if red > than sm breakpoint.
HTML);

All the sizes for the CLI are based on Font Size 15.

HTML Elements Supported

All the elements have the capability to use the class attribute.

The

element can be used as a block type element.

Default Styles: block

render(<<<'HTML'
    
This is a div element.
HTML);

The

element can be used as a paragraph.

Default Styles: block

render(<<<'HTML'
    

This is a paragraph.

HTML);

The element can be used as an inline text container.

Termwind.

HTML);">
render(<<<'HTML'
    

This is a CLI app built with Termwind.

HTML);

The element can be used as a hyperlink. It allows to use the href attribute to open the link when clicked.

Click here to open

HTML);">
render(<<<'HTML'
    

This is a CLI app built with Termwind. Click here to open

HTML);

and

The and elements can be used to mark the text as bold.

Default Styles: font-bold

render(<<<'HTML'
    

This is a CLI app built with Termwind.

HTML);

and

The and elements can be used to mark the text as italic.

Default Styles: italic

render(<<<'HTML'
    

This is a CLI app built with Termwind.

HTML);

The element can be used to add a line through the text.

Default Styles: line-through

render(<<<'HTML'
    

This is a CLI app built with Termwind.

HTML);


The
element can be used to do a line break.

render(<<<'HTML'
    

This is a CLI
app built with Termwind.

HTML);

The

    element can be used for an unordered list. It can only accept
  • elements as childs, if there is another element provided it will throw an InvalidChild exception.

    Default Styles: block, list-disc

    render(<<<'HTML'
        
    • Item 1
    • Item 2
    HTML);

    The

      element can be used for an ordered list. It can only accept
    1. elements as childs, if there is another element provided it will throw an InvalidChild exception.

      Default Styles: block, list-decimal

      render(<<<'HTML'
          
      1. Item 1
      2. Item 2
      HTML);

    2. The

    3. element can be used as a list item. It should only be used as a child of
        and
          elements.

          Default Styles: block, list-decimal

          render(<<<'HTML'
              
          • Item 1
          HTML);

          The

          element can be used for a description list. It can only accept
          or
          elements as childs, if there is another element provided it will throw an InvalidChild exception.

          Default Styles: block

          render(<<<'HTML'
              
          Termwind
          Give your CLI apps a unique look
          HTML);

          The

          element can be used as a description title. It should only be used as a child of
          elements.

          Default Styles: block, font-bold

          render(<<<'HTML'
              
          Termwind
          HTML);

          The

          element can be used as a description title. It should only be used as a child of
          elements.

          Default Styles: block, ml-4

          render(<<<'HTML'
              
          Give your CLI apps a unique look
          HTML);


          The


          element can be used as a horizontal line.

          render(<<<'HTML'
              
          Termwind

          Give your CLI apps a unique look

          HTML);

          The

          element can have columns and rows.

          render(<<<'HTML'
              
          Task Status
          Termwind Done
          HTML);

          The

           element can be used as preformatted text.

          render(<<<'HTML'
              
          
                  Text in a pre element
                  it preserves
                  both      spaces and
                  line breaks
              
          HTML);

          The element can be used as code highlighter. It accepts line and start-line attributes.

          try { throw new Exception('Something went wrong'); } catch (Throwable $e) { report($e); } HTML);">
          render(<<<'HTML'
              
                  try {
                      throw new Exception('Something went wrong');
                  } catch (Throwable $e) {
                      report($e);
                  }
              
          HTML);

          Termwind is an open-sourced software licensed under the MIT license.

Expand
Additional Information