Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A Ratatui widget to turn any image to a splash screen in your terminal ✨

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
NotificationsYou must be signed in to change notification settings

orhun/ratatui-splash-screen

ARatatui widget to turn any image to a splash screen in your terminal ✨

demo

crates.io badgedocs.rs badgelicense badgecodecov.io badgediscord badge

See the demo ofgpg-tui for a real world example.

Features

  • Turn any image (jpg,png) into a splash screen!
  • Verifies the file integrity via checking SHA checksum (optional)
  • Supports grayscaling

Installation

deps.rs badge

cargo add ratatui ratatui-splash-screen

Usage

Create aSplashConfig and construct aSplashScreen widget with it.Then render the widget in a loop using therender function.You can check if the splash screen is done rendering by callingis_rendered.

Examples

use std::error::Error;use std::io::stdout;use std::time::Duration;use ratatui::prelude::*;use ratatui_splash_screen::{SplashConfig,SplashScreen,SplashError};staticSPLASH_CONFIG:SplashConfig =SplashConfig{image_data:include_bytes!("../assets/splash.png"),sha256sum:Some("c692ae1f9bd4a03cb6fc74a71cb585a8d70c2eacda8ec95e26aa0d6a0670cffd"),render_steps:12,use_colors:true,};fnmain() ->Result<(),Box<dynError>>{// create a terminallet backend =CrosstermBackend::new(stdout());letmut terminal =Terminal::new(backend)?;// render splash screenletmut splash_screen =SplashScreen::new(SPLASH_CONFIG)?;while !splash_screen.is_rendered(){        terminal.draw(|frame|{            frame.render_widget(&mut splash_screen, frame.size());})?;        std::thread::sleep(Duration::from_millis(100));}Ok(())}

See the full examplehere.

Tips

  • Use small images (such as 200x200) for a better experience.
  • You can tweak therender_steps value for smoother rendering.
  • Runsha256sum(1) command on your system to find out the SHA value. You can set it toNone if you don't want to check integrity.

Contributing

See thecontribution guidelines.

License

License: MITLicense: Apache 2.0

Licensed under either ofApache License Version 2.0 orThe MIT License at your option.

🦀 ノ( º _ º ノ) - respect crables!

Copyright

Copyright © 2024,Orhun Parmaksız

About

A Ratatui widget to turn any image to a splash screen in your terminal ✨

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Contributing

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp