pastel-0.11.0/.cargo_vcs_info.json0000644000000001360000000000100124030ustar { "git": { "sha1": "9b4642682f23daa99c981f1c45da9cc12c936cc1" }, "path_in_vcs": "" }pastel-0.11.0/.github/dependabot.yml000064400000000000000000000004271046102023000153660ustar 00000000000000version: 2 updates: - package-ecosystem: cargo directory: "/" schedule: interval: monthly time: "04:00" timezone: Europe/Berlin - package-ecosystem: "github-actions" directory: "/" schedule: interval: monthly time: "04:00" timezone: Europe/Berlin pastel-0.11.0/.github/workflows/CICD.yml000064400000000000000000000354131046102023000160230ustar 00000000000000name: CICD env: CICD_INTERMEDIATES_DIR: "_cicd-intermediates" MSRV_FEATURES: "" on: workflow_dispatch: pull_request: push: branches: - master tags: - '*' jobs: crate_metadata: name: Extract crate metadata runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - name: Extract crate information id: crate_metadata run: | cargo metadata --no-deps --format-version 1 | jq -r '"name=" + .packages[0].name' | tee -a $GITHUB_OUTPUT cargo metadata --no-deps --format-version 1 | jq -r '"version=" + .packages[0].version' | tee -a $GITHUB_OUTPUT cargo metadata --no-deps --format-version 1 | jq -r '"maintainer=" + .packages[0].authors[0]' | tee -a $GITHUB_OUTPUT cargo metadata --no-deps --format-version 1 | jq -r '"homepage=" + .packages[0].homepage' | tee -a $GITHUB_OUTPUT cargo metadata --no-deps --format-version 1 | jq -r '"msrv=" + .packages[0].rust_version' | tee -a $GITHUB_OUTPUT outputs: name: ${{ steps.crate_metadata.outputs.name }} version: ${{ steps.crate_metadata.outputs.version }} maintainer: ${{ steps.crate_metadata.outputs.maintainer }} homepage: ${{ steps.crate_metadata.outputs.homepage }} msrv: ${{ steps.crate_metadata.outputs.msrv }} ensure_cargo_fmt: name: Ensure 'cargo fmt' has been run runs-on: ubuntu-latest steps: - uses: dtolnay/rust-toolchain@stable with: components: rustfmt - uses: actions/checkout@v5 - run: cargo fmt -- --check min_version: name: Minimum supported rust version runs-on: ubuntu-latest needs: crate_metadata steps: - name: Checkout source code uses: actions/checkout@v5 - name: Install rust toolchain (v${{ needs.crate_metadata.outputs.msrv }}) uses: dtolnay/rust-toolchain@master with: toolchain: ${{ needs.crate_metadata.outputs.msrv }} components: clippy - name: Run clippy (on minimum supported rust version to prevent warnings we can't fix) run: cargo clippy --locked --all-targets ${{ env.MSRV_FEATURES }} - name: Run tests run: cargo test --locked ${{ env.MSRV_FEATURES }} build: name: ${{ matrix.job.target }} (${{ matrix.job.os }}) runs-on: ${{ matrix.job.os }} needs: crate_metadata strategy: fail-fast: false matrix: job: - { target: aarch64-apple-darwin , os: macos-latest } - { target: aarch64-unknown-linux-gnu , os: ubuntu-latest, use-cross: true } - { target: arm-unknown-linux-gnueabihf , os: ubuntu-latest, use-cross: true } - { target: arm-unknown-linux-musleabihf, os: ubuntu-latest, use-cross: true } - { target: i686-pc-windows-msvc , os: windows-latest } - { target: i686-unknown-linux-gnu , os: ubuntu-latest, use-cross: true } - { target: i686-unknown-linux-musl , os: ubuntu-latest, use-cross: true } - { target: x86_64-apple-darwin , os: macos-latest } - { target: x86_64-pc-windows-gnu , os: windows-latest } - { target: x86_64-pc-windows-msvc , os: windows-latest } - { target: x86_64-unknown-linux-gnu , os: ubuntu-latest, use-cross: true } - { target: x86_64-unknown-linux-musl , os: ubuntu-latest, use-cross: true } env: BUILD_CMD: cargo steps: - name: Checkout source code uses: actions/checkout@v5 - name: Install prerequisites shell: bash run: | case ${{ matrix.job.target }} in arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; esac - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.job.target }} - name: Install cross if: matrix.job.use-cross uses: taiki-e/install-action@v2 with: tool: cross - name: Overwrite build command env variable if: matrix.job.use-cross shell: bash run: echo "BUILD_CMD=cross" >> $GITHUB_ENV - name: Show version information (Rust, cargo, GCC) shell: bash run: | gcc --version || true rustup -V rustup toolchain list rustup default cargo -V rustc -V - name: Build shell: bash run: $BUILD_CMD build --locked --release --target=${{ matrix.job.target }} - name: Set binary name & path id: bin shell: bash run: | # Figure out suffix of binary EXE_suffix="" case ${{ matrix.job.target }} in *-pc-windows-*) EXE_suffix=".exe" ;; esac; # Setup paths BIN_NAME="${{ needs.crate_metadata.outputs.name }}${EXE_suffix}" BIN_PATH="target/${{ matrix.job.target }}/release/${BIN_NAME}" # Let subsequent steps know where to find the binary echo "BIN_PATH=${BIN_PATH}" >> $GITHUB_OUTPUT echo "BIN_NAME=${BIN_NAME}" >> $GITHUB_OUTPUT - name: Set testing options id: test-options shell: bash run: | # test only library unit tests and binary for arm-type targets unset CARGO_TEST_OPTIONS unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--bin ${{ needs.crate_metadata.outputs.name }}" ;; esac; echo "CARGO_TEST_OPTIONS=${CARGO_TEST_OPTIONS}" >> $GITHUB_OUTPUT - name: Run tests shell: bash run: $BUILD_CMD test --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} - name: Create tarball id: package shell: bash run: | PKG_suffix=".tar.gz" ; case ${{ matrix.job.target }} in *-pc-windows-*) PKG_suffix=".zip" ;; esac; PKG_BASENAME=${{ needs.crate_metadata.outputs.name }}-v${{ needs.crate_metadata.outputs.version }}-${{ matrix.job.target }} PKG_NAME=${PKG_BASENAME}${PKG_suffix} echo "PKG_NAME=${PKG_NAME}" >> $GITHUB_OUTPUT PKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/package" ARCHIVE_DIR="${PKG_STAGING}/${PKG_BASENAME}/" mkdir -p "${ARCHIVE_DIR}" mkdir -p "${ARCHIVE_DIR}/autocomplete" mkdir -p "${ARCHIVE_DIR}/man" # Binary cp "${{ steps.bin.outputs.BIN_PATH }}" "$ARCHIVE_DIR" # README, LICENSE and CHANGELOG files cp "README.md" "LICENSE-MIT" "LICENSE-APACHE" "CHANGELOG.md" "$ARCHIVE_DIR" # Man pages cp 'target/${{ matrix.job.target }}/release/build/${{ needs.crate_metadata.outputs.name }}'*/out/*.1 "$ARCHIVE_DIR/man/" # Autocompletion files cp 'target/${{ matrix.job.target }}/release/build/${{ needs.crate_metadata.outputs.name }}'*/out/'${{ needs.crate_metadata.outputs.name }}.bash' "$ARCHIVE_DIR/autocomplete/" cp 'target/${{ matrix.job.target }}/release/build/${{ needs.crate_metadata.outputs.name }}'*/out/_'${{ needs.crate_metadata.outputs.name }}' "$ARCHIVE_DIR/autocomplete/" cp 'target/${{ matrix.job.target }}/release/build/${{ needs.crate_metadata.outputs.name }}'*/out/'${{ needs.crate_metadata.outputs.name }}.fish' "$ARCHIVE_DIR/autocomplete/" cp 'target/${{ matrix.job.target }}/release/build/${{ needs.crate_metadata.outputs.name }}'*/out/'_${{ needs.crate_metadata.outputs.name }}.ps1' "$ARCHIVE_DIR/autocomplete/" # base compressed package pushd "${PKG_STAGING}/" >/dev/null case ${{ matrix.job.target }} in *-pc-windows-*) 7z -y a "${PKG_NAME}" "${PKG_BASENAME}"/* | tail -2 ;; *) tar czf "${PKG_NAME}" "${PKG_BASENAME}"/* ;; esac; popd >/dev/null # Let subsequent steps know where to find the compressed package echo "PKG_PATH=${PKG_STAGING}/${PKG_NAME}" >> $GITHUB_OUTPUT - name: Create Debian package id: debian-package shell: bash if: startsWith(matrix.job.os, 'ubuntu') run: | COPYRIGHT_YEARS="2018 - "$(date "+%Y") DPKG_STAGING="${{ env.CICD_INTERMEDIATES_DIR }}/debian-package" DPKG_DIR="${DPKG_STAGING}/dpkg" mkdir -p "${DPKG_DIR}" DPKG_BASENAME=${{ needs.crate_metadata.outputs.name }} DPKG_CONFLICTS=${{ needs.crate_metadata.outputs.name }}-musl case ${{ matrix.job.target }} in *-musl*) DPKG_BASENAME=${{ needs.crate_metadata.outputs.name }}-musl ; DPKG_CONFLICTS=${{ needs.crate_metadata.outputs.name }} ;; esac; DPKG_VERSION=${{ needs.crate_metadata.outputs.version }} unset DPKG_ARCH case ${{ matrix.job.target }} in aarch64-*-linux-*) DPKG_ARCH=arm64 ;; arm-*-linux-*hf) DPKG_ARCH=armhf ;; i686-*-linux-*) DPKG_ARCH=i686 ;; x86_64-*-linux-*) DPKG_ARCH=amd64 ;; *) DPKG_ARCH=notset ;; esac; DPKG_NAME="${DPKG_BASENAME}_${DPKG_VERSION}_${DPKG_ARCH}.deb" echo "DPKG_NAME=${DPKG_NAME}" >> $GITHUB_OUTPUT # Binary install -Dm755 "${{ steps.bin.outputs.BIN_PATH }}" "${DPKG_DIR}/usr/bin/${{ steps.bin.outputs.BIN_NAME }}" # Man pages for manpage in 'target/${{ matrix.job.target }}/release/build/${{ needs.crate_metadata.outputs.name }}'*/out/*.1; do manpage_name=$(basename "$manpage") install -Dm644 "$manpage" "${DPKG_DIR}/usr/share/man/man1/${manpage_name}" gzip -n --best "${DPKG_DIR}/usr/share/man/man1/${manpage_name}" done # Autocompletion files install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ needs.crate_metadata.outputs.name }}'*/out/'${{ needs.crate_metadata.outputs.name }}.bash' "${DPKG_DIR}/usr/share/bash-completion/completions/${{ needs.crate_metadata.outputs.name }}" install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ needs.crate_metadata.outputs.name }}'*/out/_'${{ needs.crate_metadata.outputs.name }}' "${DPKG_DIR}/usr/share/zsh/vendor-completions/_${{ needs.crate_metadata.outputs.name }}" install -Dm644 'target/${{ matrix.job.target }}/release/build/${{ needs.crate_metadata.outputs.name }}'*/out/'${{ needs.crate_metadata.outputs.name }}.fish' "${DPKG_DIR}/usr/share/fish/vendor_completions.d/${{ needs.crate_metadata.outputs.name }}.fish" # README and LICENSE install -Dm644 "README.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/README.md" install -Dm644 "LICENSE-MIT" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-MIT" install -Dm644 "LICENSE-APACHE" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/LICENSE-APACHE" install -Dm644 "CHANGELOG.md" "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog" gzip -n --best "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/changelog" cat > "${DPKG_DIR}/usr/share/doc/${DPKG_BASENAME}/copyright" < "${DPKG_DIR}/DEBIAN/control" <> $GITHUB_OUTPUT # build dpkg fakeroot dpkg-deb --build "${DPKG_DIR}" "${DPKG_PATH}" - name: "Artifact upload: tarball" uses: actions/upload-artifact@v4 with: name: ${{ steps.package.outputs.PKG_NAME }} path: ${{ steps.package.outputs.PKG_PATH }} - name: "Artifact upload: Debian package" uses: actions/upload-artifact@v4 if: steps.debian-package.outputs.DPKG_NAME with: name: ${{ steps.debian-package.outputs.DPKG_NAME }} path: ${{ steps.debian-package.outputs.DPKG_PATH }} - name: Check for release id: is-release shell: bash run: | unset IS_RELEASE ; if [[ $GITHUB_REF =~ ^refs/tags/v[0-9].* ]]; then IS_RELEASE='true' ; fi echo "IS_RELEASE=${IS_RELEASE}" >> $GITHUB_OUTPUT - name: Publish archives and packages uses: softprops/action-gh-release@v2 if: steps.is-release.outputs.IS_RELEASE with: files: | ${{ steps.package.outputs.PKG_PATH }} ${{ steps.debian-package.outputs.DPKG_PATH }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} winget: name: Publish to Winget runs-on: ubuntu-latest needs: build if: startsWith(github.ref, 'refs/tags/v') steps: - uses: vedantmgoyal2009/winget-releaser@v2 with: identifier: sharkdp.pastel installers-regex: '-pc-windows-msvc\.zip$' token: ${{ secrets.WINGET_TOKEN }} pastel-0.11.0/.gitignore000064400000000000000000000000231046102023000131560ustar 00000000000000/target **/*.rs.bk pastel-0.11.0/CHANGELOG.md000064400000000000000000000114531046102023000130100ustar 00000000000000# unreleased ## Features ## Bugfixes ## Changes ## Other - Minor optimizations and cleanup ## Packaging # v0.10.0 ## Features - Added alpha property to set command, see #218 (@kanielrkirby) - Add support for HSV, see #169 (@jameshurst) - Added support for parsing LCh colors, see #2 and #167 (@MForster) - Added hyprpicker as --color-picker, see #186 (@mrusme) - Implement Color::from_u32 for the rgba, see #202 (@irevoire) ## Bugfixes - `pastel pick` does not display all colors in some terminals, see #121 and #168 (@Divoolej) - Fix lines in kitty terminal with text_fg_override_threshold set, see #197 (@joveian) ## Changes - Use PASTEL_COLOR_MODE in ansi::Brush::from_environment, see #168 (@Divoolej) - Unhide colorcheck command, see #182 (@CheshireSwift) ## Other - Optimization for eliminating redundant memory operations, see #165 (@yyzdtccjdtc) - Add colour as an alias for the color command, see #173 (@BuyMyMojo) - Suggest to use pastel pick --help instead of -h, see #181 (@sharkdp) # v0.9.0 ## Features - Added support for transparency / alpha values, see #131 and #162 (@superhawk610) - Added support for `NO_COLOR` environment variable, see #143 (@djmattyg007) - Added new color pickers: Gnome/Wayland via gdbus, zenity, yad, and wcolor (@sigmaSd, @pvonmoradi) ## Packaging - Added shell completion files again, see #166 (@sharkdp) # v0.8.1 ## Features - Added `From` and `Display` traits for each color struct, see #133 (@bresilla) ## Other - Updated `lexical-core` dependency to fix a compile error with newer Rust versions ## Packaging - `pastel` is now available on snapstore, see #130 (@purveshpatel511) # v0.8.0 ## Features - Added CMYK output format, see #122 and #123 (@aeter) ## Other - Completely new CI/CD system via GitHub Actions, see #120 (@rivy) # v0.7.1 ## Bugfixes - Fixed a bug with the new `ansi-*-escapecode` formats, see #116 (@bbkane) # v0.7.0 ## Changes - **Breaking:** the existing `ansi-8bit` and `ansi-24bit` formats have been changed to print out an escaped ANSI sequence that a user can see in the terminal output. The previously existing formats are now available as `ansi-8bit-escapecode` and `ansi-24bit-escapecode`. See #113 and #111. ## Features - All CSS color formats are now supported (see #12) - Added support for multiple color stops for gradients (`pastel gradient red blue yellow`), see #49 (@felipe-fg) - Added `-f`/`--force-color` flag as an alias for `--mode=24bit`, see #48 (@samueldple) - Added `--color-picker ` to allow users to choose the colorpicker, see #96 (@d-dorazio) - Added input support for CIELAB, see #3/#101 (@MusiKid) - Added support for `rgb(255 0 119)`, `rgb(100%,0%,46.7%)`, `gray(20%)`, and many more new CSS syntaxes, see #103 (@MusiKid) - Faster and more flexible color parser, adding even more CSS color formats, see #105 (@halfbro) ## `pastel` library changes - `distinct_colors` is now available in the `pastel::distinct` module, see #95 (@rivy) ## Bugfixes - Added support for non-color consoles (Windows 7), see #91 (@rivy) ## Other - pastel is now available via Nix, see #100 (@davidtwco) # v0.6.1 ## Other - Enabled builds for arm, aarch64, and i686 - Fixed build on 32bit platforms # v0.6.0 ## Features - Added colorblindness simulations via `pastel colorblind`, see #80 (@rozbb) - Added support for pre-determined colors in `pastel distinct`, see #88 (@d-dorazio) - Added a new `set` subcommand that can be used to set specific properties of a color (`pastel set lightness 0.4`, `pastel set red 0`, etc.), see #43 - Show the color name in `pastel show` or `pastel color` if it is an exact match, for example: `pastel color ff00ff` will show "fuchsia", see #81 (@d-dorazio) - Add KColorChooser as a supported color picker, see #79 (@data-man) - Add macOS built-in color picker, see #84 (@erydo) - Added a new 'count' argument for `pastel pick []` ## Changes - `pastel distinct` has seen massive speedups, see #83 (@d-dorazio) ## Bugfixes - Mixing colors in HSL space with black or white will not rotate the hue towards red (hue 0°), see #76 ## Other - Pastel is now available via Homebrew, see README and #70 (@liamdawson) # v0.5.3 - Added `rgb-float` as a new format (e.g. `pastel random | pastel format rgb-float`). - `pastel pick` should now work in 24-bit on Windows, see #45 - Fix crash for `pastel distinct N` with N < 2 (show an error message), see #69 # v0.5.2 * Truecolor support for Windows (@lzybkr) * Re-arranging of colors in `pastel distinct` so as to maximize the minimal distance to the predecessors * Fixed small numerical approximation problem in the 'similar colors' computation * Backported to Rust 1.34 # v0.5.1 - Added shell completion files for bash, zsh, fish and PowerShell. # v0.5.0 - Added `pastel distinct N` command to generate a set of N visually distinct colors # v0.4.0 Initial public release pastel-0.11.0/Cargo.lock0000644000000704210000000000100103620ustar # This file is automatically @generated by Cargo. # It is not intended for manual editing. version = 4 [[package]] name = "aho-corasick" version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] [[package]] name = "anes" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ae563653d1938f79b1ab1b5e668c87c76a9930414574a6583a7b7e11a8e6192" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e231f6134f61b71076a3eab506c379d4f36122f2af15a9ff04415ea4c3339e2" dependencies = [ "windows-sys 0.60.2", ] [[package]] name = "anstyle-wincon" version = "3.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e0633414522a32ffaac8ac6cc8f748e090c5717661fddeea04219e2344f5f2a" dependencies = [ "anstyle", "once_cell_polyfill", "windows-sys 0.60.2", ] [[package]] name = "approx" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" dependencies = [ "num-traits", ] [[package]] name = "assert_cmd" version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bd389a4b2970a01282ee455294913c0a43724daedcd1a24c3eb0ec1c1320b66" dependencies = [ "anstyle", "bstr", "doc-comment", "libc", "predicates", "predicates-core", "predicates-tree", "wait-timeout", ] [[package]] name = "atty" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ "hermit-abi", "libc", "winapi", ] [[package]] name = "autocfg" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "bitflags" version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] name = "bstr" version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "531a9155a481e2ee699d4f98f43c0ca4ff8ee1bfd55c31e9e98fb29d2b176fe0" dependencies = [ "memchr", "regex-automata", "serde", ] [[package]] name = "bumpalo" version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "byteorder" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cast" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cfg-if" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "ciborium" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42e69ffd6f0917f5c029256a24d0161db17cea3997d185db0d35926308770f0e" dependencies = [ "ciborium-io", "ciborium-ll", "serde", ] [[package]] name = "ciborium-io" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757" [[package]] name = "ciborium-ll" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9" dependencies = [ "ciborium-io", "half", ] [[package]] name = "clap" version = "4.5.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "027bb0d98429ae334a8698531da7077bdf906419543a35a55c2cb1b66437d767" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" version = "4.5.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5589e0cba072e0f3d23791efac0fd8627b49c829c196a492e88168e6a669d863" dependencies = [ "anstream", "anstyle", "clap_lex", "strsim", "terminal_size", ] [[package]] name = "clap_complete" version = "4.5.58" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75bf0b32ad2e152de789bb635ea4d3078f6b838ad7974143e99b99f45a04af4a" dependencies = [ "clap", ] [[package]] name = "clap_lex" version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "clap_mangen" version = "0.2.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b4c3c54b30f0d9adcb47f25f61fcce35c4dd8916638c6b82fbd5f4fb4179e2" dependencies = [ "clap", "roff", ] [[package]] name = "colorchoice" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" [[package]] name = "criterion" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1c047a62b0cc3e145fa84415a3191f628e980b194c2755aa12300a4e6cbd928" dependencies = [ "anes", "cast", "ciborium", "clap", "criterion-plot", "itertools", "num-traits", "oorandom", "plotters", "rayon", "regex", "serde", "serde_json", "tinytemplate", "walkdir", ] [[package]] name = "criterion-plot" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b1bcc0dc7dfae599d84ad0b1a55f80cde8af3725da8313b528da95ef783e338" dependencies = [ "cast", "itertools", ] [[package]] name = "crossbeam-deque" version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" dependencies = [ "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crunchy" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" [[package]] name = "difflib" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6184e33543162437515c2e2b48714794e37845ec9851711914eec9d308f6ebe8" [[package]] name = "doc-comment" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] name = "either" version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7914353092ddf589ad78f25c5c1c21b7f80b0ff8621e7c814c3485b5306da9d" [[package]] name = "errno" version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", "windows-sys 0.59.0", ] [[package]] name = "getrandom" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" dependencies = [ "cfg-if", "libc", "wasi", "windows-targets 0.52.6", ] [[package]] name = "half" version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888" dependencies = [ "cfg-if", "crunchy", ] [[package]] name = "hermit-abi" version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] [[package]] name = "is_terminal_polyfill" version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] [[package]] name = "itoa" version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" [[package]] name = "js-sys" version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ "once_cell", "wasm-bindgen", ] [[package]] name = "libc" version = "0.2.170" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828" [[package]] name = "linux-raw-sys" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" [[package]] name = "log" version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" [[package]] name = "memchr" version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "minimal-lexical" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "nom" version = "7.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" dependencies = [ "memchr", "minimal-lexical", ] [[package]] name = "num-traits" version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "once_cell" version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "once_cell_polyfill" version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4895175b425cb1f87721b59f0f286c2092bd4af812243672510e1ac53e2e0ad" [[package]] name = "oorandom" version = "11.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" [[package]] name = "output_vt100" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "628223faebab4e3e40667ee0b2336d34a5b960ff60ea743ddfdbcf7770bcfb66" dependencies = [ "winapi", ] [[package]] name = "pastel" version = "0.11.0" dependencies = [ "approx", "assert_cmd", "atty", "clap", "clap_complete", "clap_mangen", "criterion", "nom", "once_cell", "output_vt100", "rand", "rand_xoshiro", "regex", ] [[package]] name = "plotters" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" dependencies = [ "num-traits", "plotters-backend", "plotters-svg", "wasm-bindgen", "web-sys", ] [[package]] name = "plotters-backend" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" [[package]] name = "plotters-svg" version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" dependencies = [ "plotters-backend", ] [[package]] name = "ppv-lite86" version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" dependencies = [ "zerocopy", ] [[package]] name = "predicates" version = "3.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5d19ee57562043d37e82899fade9a22ebab7be9cef5026b07fda9cdd4293573" dependencies = [ "anstyle", "difflib", "predicates-core", ] [[package]] name = "predicates-core" version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "727e462b119fe9c93fd0eb1429a5f7647394014cf3c04ab2c0350eeb09095ffa" [[package]] name = "predicates-tree" version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72dd2d6d381dfb73a193c7fca536518d7caee39fc8503f74e7dc0be0531b425c" dependencies = [ "predicates-core", "termtree", ] [[package]] name = "proc-macro2" version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" dependencies = [ "unicode-ident", ] [[package]] name = "quote" version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] [[package]] name = "rand" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ "rand_chacha", "rand_core", ] [[package]] name = "rand_chacha" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", "rand_core", ] [[package]] name = "rand_core" version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" dependencies = [ "getrandom", ] [[package]] name = "rand_xoshiro" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f703f4665700daf5512dcca5f43afa6af89f09db47fb56be587f80636bda2d41" dependencies = [ "rand_core", ] [[package]] name = "rayon" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", ] [[package]] name = "rayon-core" version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", ] [[package]] name = "regex" version = "1.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b5288124840bee7b386bc413c487869b360b2b4ec421ea56425128692f2a82c" dependencies = [ "aho-corasick", "memchr", "regex-automata", "regex-syntax", ] [[package]] name = "regex-automata" version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "833eb9ce86d40ef33cb1306d8accf7bc8ec2bfea4355cbdebb3df68b40925cad" dependencies = [ "aho-corasick", "memchr", "regex-syntax", ] [[package]] name = "regex-syntax" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "roff" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88f8660c1ff60292143c98d08fc6e2f654d722db50410e3f3797d40baaf9d8f3" [[package]] name = "rustix" version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", "windows-sys 0.60.2", ] [[package]] name = "rustversion" version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" [[package]] name = "ryu" version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ea1a2d0a644769cc99faa24c3ad26b379b786fe7c36fd3c546254801650e6dd" [[package]] name = "same-file" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" dependencies = [ "winapi-util", ] [[package]] name = "serde" version = "1.0.218" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8dfc9d19bdbf6d17e22319da49161d5d0108e4188e8b680aef6299eed22df60" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" version = "1.0.218" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f09503e191f4e797cb8aac08e9a4a4695c5edf6a2e70e376d961ddd5c969f82b" dependencies = [ "proc-macro2", "quote", "syn", ] [[package]] name = "serde_json" version = "1.0.139" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44f86c3acccc9c65b153fe1b85a3be07fe5515274ec9f0653b4a0875731c72a6" dependencies = [ "itoa", "memchr", "ryu", "serde", ] [[package]] name = "strsim" version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "syn" version = "2.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] [[package]] name = "terminal_size" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b8cb979cb11c32ce1603f8137b22262a9d131aaa5c37b5678025f22b8becd0" dependencies = [ "rustix", "windows-sys 0.60.2", ] [[package]] name = "termtree" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f50febec83f5ee1df3015341d8bd429f2d1cc62bcba7ea2076759d315084683" [[package]] name = "tinytemplate" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc" dependencies = [ "serde", "serde_json", ] [[package]] name = "unicode-ident" version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00e2473a93778eb0bad35909dff6a10d28e63f792f16ed15e404fca9d5eeedbe" [[package]] name = "utf8parse" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "wait-timeout" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" dependencies = [ "libc", ] [[package]] name = "walkdir" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", ] [[package]] name = "wasi" version = "0.13.3+wasi-0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" dependencies = [ "wit-bindgen-rt", ] [[package]] name = "wasm-bindgen" version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", "proc-macro2", "quote", "syn", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" dependencies = [ "unicode-ident", ] [[package]] name = "web-sys" version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", ] [[package]] name = "winapi" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" dependencies = [ "winapi-i686-pc-windows-gnu", "winapi-x86_64-pc-windows-gnu", ] [[package]] name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ "windows-sys 0.59.0", ] [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-link" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" [[package]] name = "windows-sys" version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ "windows-targets 0.52.6", ] [[package]] name = "windows-sys" version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ "windows-targets 0.53.3", ] [[package]] name = "windows-targets" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] [[package]] name = "windows-targets" version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ "windows-link", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", "windows_i686_gnullvm 0.53.0", "windows_i686_msvc 0.53.0", "windows_x86_64_gnu 0.53.0", "windows_x86_64_gnullvm 0.53.0", "windows_x86_64_msvc 0.53.0", ] [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_gnullvm" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_aarch64_msvc" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnu" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_gnullvm" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_i686_msvc" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnu" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_gnullvm" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "windows_x86_64_msvc" version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" [[package]] name = "wit-bindgen-rt" version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" dependencies = [ "bitflags", ] [[package]] name = "zerocopy" version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", "syn", ] pastel-0.11.0/Cargo.toml0000644000000042640000000000100104070ustar # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO # # When uploading crates to the registry Cargo will automatically # "normalize" Cargo.toml files for maximal compatibility # with all versions of Cargo and also rewrite `path` dependencies # to registry (e.g., crates.io) dependencies. # # If you are reading this file be aware that the original Cargo.toml # will likely look very different (and much more reasonable). # See Cargo.toml.orig for the original contents. [package] edition = "2021" rust-version = "1.83.0" name = "pastel" version = "0.11.0" authors = ["David Peter "] build = "build.rs" exclude = ["doc/pastel.gif"] autolib = false autobins = false autoexamples = false autotests = false autobenches = false description = "A command-line tool to generate, analyze, convert and manipulate colors" homepage = "https://github.com/sharkdp/pastel" readme = "README.md" categories = ["command-line-utilities"] license = "MIT/Apache-2.0" repository = "https://github.com/sharkdp/pastel" [lib] name = "pastel" path = "src/lib.rs" [[bin]] name = "pastel" path = "src/cli/main.rs" [[test]] name = "integration_tests" path = "tests/integration_tests.rs" [[bench]] name = "parse_color" path = "benches/parse_color.rs" harness = false [dependencies.atty] version = "0.2" [dependencies.clap] version = "4" features = [ "suggestions", "color", "wrap_help", "cargo", ] [dependencies.nom] version = "7.1.3" [dependencies.once_cell] version = "1.21.3" [dependencies.output_vt100] version = "0.1" [dependencies.rand] version = "0.9" [dependencies.regex] version = "1.11" [dev-dependencies.approx] version = "0.5.0" [dev-dependencies.assert_cmd] version = "2.0.17" [dev-dependencies.criterion] version = "0.7" [dev-dependencies.rand_xoshiro] version = "0.7.0" [build-dependencies.clap] version = "4" features = ["cargo"] [build-dependencies.clap_complete] version = "4" [build-dependencies.clap_mangen] version = "0.2" [build-dependencies.once_cell] version = "1.21.3" [build-dependencies.output_vt100] version = "0.1" [lints.rust.unexpected_cfgs] level = "warn" priority = 0 check-cfg = ["cfg(pastel_normal_build)"] [profile.release] lto = true codegen-units = 1 strip = true pastel-0.11.0/Cargo.toml.orig000064400000000000000000000023641046102023000140670ustar 00000000000000[package] authors = ["David Peter "] categories = ["command-line-utilities"] description = "A command-line tool to generate, analyze, convert and manipulate colors" homepage = "https://github.com/sharkdp/pastel" license = "MIT/Apache-2.0" name = "pastel" readme = "README.md" repository = "https://github.com/sharkdp/pastel" version = "0.11.0" edition = "2021" build = "build.rs" exclude = ["doc/pastel.gif"] rust-version = "1.83.0" [dependencies] # library dependencies atty = "0.2" nom = "7.1.3" once_cell = "1.21.3" output_vt100 = "0.1" rand = "0.9" # binary-only dependencies (see https://github.com/rust-lang/cargo/issues/1982) regex = "1.11" [dependencies.clap] version = "4" features = ["suggestions", "color", "wrap_help", "cargo"] [build-dependencies] clap = { version = "4", features = ["cargo"] } clap_complete = "4" clap_mangen = "0.2" once_cell = "1.21.3" output_vt100 = "0.1" [[bin]] name = "pastel" path = "src/cli/main.rs" [dev-dependencies] approx = "0.5.0" assert_cmd = "2.0.17" rand_xoshiro = "0.7.0" criterion = "0.7" [[bench]] name = "parse_color" harness = false [profile.release] lto = true strip = true codegen-units = 1 [lints.rust] unexpected_cfgs = { level = "warn", check-cfg = ['cfg(pastel_normal_build)'] } pastel-0.11.0/LICENSE-APACHE000064400000000000000000000261351046102023000131260ustar 00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. pastel-0.11.0/LICENSE-MIT000064400000000000000000000017771046102023000126430ustar 00000000000000Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. pastel-0.11.0/README.md000064400000000000000000000147311046102023000124600ustar 00000000000000# pastel [![Build Status](https://img.shields.io/github/actions/workflow/status/sharkdp/pastel/CICD.yml?style=flat-square)](https://github.com/sharkdp/pastel/actions) [![](https://img.shields.io/github/v/release/sharkdp/pastel?colorB=d7a400&style=flat-square)](https://github.com/sharkdp/pastel/releases) [![](https://img.shields.io/crates/l/pastel.svg?colorB=ff7155&style=flat-square)](https://crates.io/crates/pastel) [![](https://img.shields.io/crates/v/pastel.svg?colorB=ff69b4&style=flat-square)](https://crates.io/crates/pastel) `pastel` is a command-line tool to generate, analyze, convert and manipulate colors. It supports many different color formats and color spaces like RGB (sRGB), HSL, CIELAB, CIELCh as well as ANSI 8-bit and 24-bit representations. ## In action ![pastel in action](doc/pastel.gif) ## Tutorial ### Getting help `pastel` provides a number of commands like `saturate`, `mix` or `paint`. To see a complete list, you can simply run ``` bash pastel ``` To get more information about a specific subcommand (say `mix`), you can call `pastel mix -h` or `pastel help mix`. ### Composition Many `pastel` commands can be composed by piping the output of one command to another, for example: ``` bash pastel random | pastel mix red | pastel lighten 0.2 | pastel format hex ``` ### Specifying colors Colors can be specified in many different formats: ``` lightslategray '#778899' 778899 789 'rgb(119, 136, 153)' '119,136,153' 'hsl(210, 14.3%, 53.3%)' ``` Colors can be passed as positional arguments, for example: ``` pastel lighten 0.2 orchid orange lawngreen ``` They can also be read from standard input. So this is equivalent: ``` printf "%s\n" orchid orange lawngreen | pastel lighten 0.2 ``` You can also explicitly specify which colors you want to read from the input. For example, this mixes `red` (which is read from STDIN) with `blue` (which is passed on the command line): ``` pastel color red | pastel mix - blue ``` ### Use cases and demo #### Converting colors from one format to another ``` bash pastel format hsl ff8000 ``` #### Show and analyze colors on the terminal ``` bash pastel color "rgb(255,50,127)" pastel color 556270 4ecdc4 c7f484 ff6b6b c44d58 ``` #### Pick a color from somewhere on the screen ``` bash pastel pick ``` #### Generate a set of N visually distinct colors ``` pastel distinct 8 ``` #### Get a list of all X11 / CSS color names ``` bash pastel list ``` #### Name a given color ``` bash pastel format name 44cc11 ``` #### Print colorized text from a shell script ``` bash bg="hotpink" fg="$(pastel textcolor "$bg")" pastel paint "$fg" --on "$bg" "well readable text" ``` ``` bash pastel paint -n black --on red --bold " ERROR! " echo " A serious error" pastel paint -n black --on yellow --bold " WARNING! " echo " A warning message" pastel paint -n black --on limegreen --bold " INFO " echo -n " Informational message with a " echo -n "highlighted" | pastel paint -n default --underline echo " word" ``` ## Installation ### On Debian-based systems You can download the latest Debian package from the [release page](https://github.com/sharkdp/pastel/releases) and install it via `dpkg`: ``` bash wget "https://github.com/sharkdp/pastel/releases/download/v0.11.0/pastel_0.11.0_amd64.deb" sudo dpkg -i pastel_0.11.0_amd64.deb ``` Alternatively, `pastel` is available in the official Debian repositories (currently in testing and unstable): ```bash sudo apt update sudo apt install pastel ``` ### On Arch Linux You can install `pastel` from the [Extra](https://archlinux.org/packages/extra/x86_64/pastel/) repositories: ``` sudo pacman -S pastel ``` ### On Nix You can install `pastel` from the [Nix package](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/misc/pastel/default.nix): ``` nix-env --install pastel ``` ### On MacOS You can install `pastel` via [Homebrew](https://formulae.brew.sh/formula/pastel) ``` brew install pastel ``` ### On Windows You can install `pastel` via [Scoop](https://github.com/ScoopInstaller/Main/blob/master/bucket/pastel.json) ``` scoop install pastel ``` #### With Winget You can install `pastel` via [Winget](https://learn.microsoft.com/en-us/windows/package-manager/): ```bash winget install sharkdp.pastel ``` ### Via snap package [Get it from the Snap Store](https://snapcraft.io/pastel): ``` sudo snap install pastel ``` ### On NetBSD Using the package manager: ``` pkgin install pastel ``` From source: ``` cd /usr/pkgsrc/graphics/pastel make install ``` ### On other distributions Check out the [release page](https://github.com/sharkdp/pastel/releases) for binary builds. ### Via cargo (source) If you do not have cargo, install using [rust's installation documentation](https://doc.rust-lang.org/book/ch01-01-installation.html). If you have Rust 1.83 or higher, you can install `pastel` from source via `cargo`: ``` cargo install pastel ``` Alternatively, you can install `pastel` directly from this repository by using ``` git clone https://github.com/sharkdp/pastel cargo install --path ./pastel ``` ## Resources Interesting Wikipedia pages: * [Color difference](https://en.wikipedia.org/wiki/Color_difference) * [CIE 1931 color space](https://en.wikipedia.org/wiki/CIE_1931_color_space) * [CIELAB color space](https://en.wikipedia.org/wiki/CIELAB_color_space) * [Line of purples](https://en.wikipedia.org/wiki/Line_of_purples) * [Impossible color](https://en.wikipedia.org/wiki/Impossible_color) * [sRGB](https://en.wikipedia.org/wiki/SRGB) * [Color theory](https://en.wikipedia.org/wiki/Color_theory) * [Eigengrau](https://en.wikipedia.org/wiki/Eigengrau) Color names: * [XKCD Color Survey Results](https://blog.xkcd.com/2010/05/03/color-survey-results/) * [Peachpuffs and Lemonchiffons - talk about named colors](https://www.youtube.com/watch?v=HmStJQzclHc) * [List of CSS color keywords](https://www.w3.org/TR/SVG11/types.html#ColorKeywords) Maximally distinct colors: * [How to automatically generate N "distinct" colors?](https://stackoverflow.com/q/470690/704831) * [Publication on two algorithms to generate (maximally) distinct colors](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.65.2790) Other articles and videos: * [Color Matching](https://www.youtube.com/watch?v=82ItpxqPP4I) * [Introduction to color spaces](https://ciechanow.ski/color-spaces/) ## License Licensed under either of * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) at your option. pastel-0.11.0/benches/parse_color.rs000064400000000000000000000012201046102023000154530ustar 00000000000000use criterion::{criterion_group, criterion_main, Criterion}; use pastel::parser::parse_color; fn criterion_benchmark(c: &mut Criterion) { c.bench_function("parse_hex", |b| { b.iter(|| { parse_color("#ff0077"); }) }); c.bench_function("parse_hex_short", |b| { b.iter(|| { parse_color("#f07"); }) }); c.bench_function("parse_rgb", |b| { b.iter(|| { parse_color("rgb(255, 125, 0)"); }) }); c.bench_function("parse_hsl", |b| b.iter(|| parse_color("hsl(280,20%,50%)"))); } criterion_group!(benches, criterion_benchmark); criterion_main!(benches); pastel-0.11.0/build.rs000064400000000000000000000030061046102023000126370ustar 00000000000000use clap_complete::{generate_to, Shell}; use clap_mangen::Man; use std::fs; include!("src/cli/colorpicker_tools.rs"); include!("src/cli/cli.rs"); fn main() { let var = std::env::var_os("SHELL_COMPLETIONS_DIR").or_else(|| std::env::var_os("OUT_DIR")); let outdir = match var { None => return, Some(outdir) => outdir, }; fs::create_dir_all(&outdir).unwrap(); let mut cmd = build_cli(); for shell in [Shell::Bash, Shell::Zsh, Shell::Fish, Shell::PowerShell] { generate_to(shell, &mut cmd, crate_name!(), &outdir).unwrap(); } let man = Man::new(cmd.clone()); let mut buffer: Vec = Default::default(); man.render(&mut buffer).expect("Man page generation failed"); let man_path = std::path::Path::new(&outdir).join("pastel.1"); fs::write(man_path, buffer).expect("Failed to write main man page"); for subcommand in cmd.get_subcommands() { let subcommand_name = subcommand.get_name(); // help command doesn't need its own man page if subcommand_name == "help" { continue; } let man = Man::new(subcommand.clone()); let mut buffer: Vec = Default::default(); man.render(&mut buffer) .expect("Subcommand man page generation failed"); let man_path = std::path::Path::new(&outdir).join(format!("pastel-{}.1", subcommand_name)); fs::write(man_path, buffer).expect("Failed to write subcommand man page"); } println!("cargo:rustc-cfg=pastel_normal_build"); } pastel-0.11.0/doc/colorcheck.md000064400000000000000000000013441046102023000144000ustar 00000000000000# colorcheck The `colorcheck` command can be used to test whether or not your terminal emulator properly supports 24-bit true color mode (16,777,216 colors). If this is not the case, `pastel` can only show 8-bit approximations (256 colors): ``` bash pastel colorcheck ``` If everything works correctly, the output should look likes this (the background color and font colors may be different, but the color panels should look the same): ![](colorcheck.png) If you find it hard to compare the colors visually, you can also use a colorpicker (`pastel pick`) to make sure that the three colors in the 24-bit panels are (from left to right): * `#492732`, `rgb(73, 39, 50)` * `#10331e`, `rgb(16, 51, 30)` * `#1d365a`, `rgb(29, 54, 90)` pastel-0.11.0/doc/colorcheck.png000064400000000000000000000100701046102023000145600ustar 00000000000000PNG  IHDR&?niCCPICC profile(}=H@_SE*@!Cu *U(BR+`r4iHR\ׂUg]\AIEJ_Rhq?{ܽzf8jLvU "Їa\2wQ}ѭLDYs'tAG.q.8,̰NBm̊J7e[k M]%nC`@f?Mr΂ pHYsKtIME" Jn!tEXtCommentCreated with GIMPW"IDATxmLSg@x)Z^Tq[ # P($-d tn3b4A7 D 1e"_ S Q}Bc{|OǞp{S*t:Oq$H$'XreAA… 1f;R"Nwĉ+i3ۻ_ѣG;w֭[+++/_O\BBo]WWW_dff.YdF^~joBwwdV_ÇGw^xx%Kn߾=cz}JJRtѣG?~,ʒ:uÇ;;; !2222227o.\HLL>??_jժV^VVv??oz+W&=mTTԺu,Kyyd7)))>>СC׮]caWJP(BCCƦ9ϔJe\\ɓ'oݺe4o޼s޽[ٳgt^;00d2F+Vj梢;w.X@:*55h4Lcǎ-^x'EffݻwZ[[o2q@ddOXXs3UTT}G===>>>kmmv͟?_NbHv}v.,,,**JaZ|}}Vssuuu555M yIIIEEEB\XXv\BVZZ*wށgKNN*** 5 7nܐ/_ܹs!|rK. ׬Ye˖f!D|||LL%%%rrcccv]122t*o!\\\Z|M8007g!FQ*---.!Bpttx;铥 O5++L?FB`-lnk4̙36mڸql^zceeFGGKm*//ߵkWvvvuuG|||~~~[[< ==}޼y*isAuuu**"""::O$H+ʲQ͋ST?wttݻK.7>}ZVGGG/^|aSSj),,xl6k7xW^9z^ohh}ҥK₂nݺu5&N;{4nK?!ź@r 9@r 9@r 9@rH 9szް|T ZK~iFKz6t:r 9@r 9@rH 9@rH 9$@rH 9$@rH 9$H 9$H$H$H$H$@r$@r 9@r 9y NYX@r 9@r 9@r 9@rH 9!+W,((Xp!?! رcGqqT*]\\^sN8tsΠYf[-rppߎ97qU""" 6#GMz|ܹ[n|2?""wߕcbbbbbjjjkܴwyYnGW\7.NNNFȑ#||ԝ;w۷aÆ-[ ܸq?&ӳ'ar?I@rH 9$@rH 9$H 9$H$1<_,OqPKy6OT;Ή})ƣ*pa H$H$@r$@r 9@r 9@r 9@r 9@rH 9@rH 98$@r$@r 9@r 9@r 9LBqV9@rH 9<_xIENDB`pastel-0.11.0/doc/demo-scripts/gradient.sh000064400000000000000000000007261046102023000165070ustar 00000000000000#!/bin/bash function gradient() { local color_from="$1" local color_to="$2" local text="$3" local length=${#text} local colors colors=$(pastel gradient -n "$length" "$color_from" "$color_to" -sLCh) local i=0 for color in $colors; do pastel paint -n "$color" "${text:$i:1}" i=$((i+1)) done printf "\n" } gradient yellow crimson 'look at these colors!' gradient lightseagreen lightgreen 'look at these colors!' pastel-0.11.0/src/ansi.rs000064400000000000000000000255611046102023000132730ustar 00000000000000use std::borrow::Borrow; pub use atty::Stream; use once_cell::sync::Lazy; use crate::delta_e::ciede2000; use crate::{Color, Lab}; static ANSI_LAB_REPRESENTATIONS: Lazy> = Lazy::new(|| { (16..255) .map(|code| (code, Color::from_ansi_8bit(code).to_lab())) .collect() }); #[derive(Debug, Clone, Copy, PartialEq)] pub enum Mode { Ansi8Bit, TrueColor, } #[derive(Debug)] pub struct UnknownColorModeError(pub String); impl Mode { pub fn from_mode_str(mode_str: &str) -> Result, UnknownColorModeError> { match mode_str { "24bit" | "truecolor" => Ok(Some(Mode::TrueColor)), "8bit" => Ok(Some(Mode::Ansi8Bit)), "off" => Ok(None), value => Err(UnknownColorModeError(value.into())), } } } fn cube_to_8bit(code: u8) -> u8 { assert!(code < 6); match code { 0 => 0, _ => 55 + 40 * code, } } pub trait AnsiColor { fn from_ansi_8bit(code: u8) -> Self; fn to_ansi_8bit(&self) -> u8; fn to_ansi_sequence(&self, mode: Mode) -> String; } impl AnsiColor for Color { /// Create a color from an 8-bit ANSI escape code /// /// See: fn from_ansi_8bit(code: u8) -> Color { match code { 0 => Color::black(), 1 => Color::maroon(), 2 => Color::green(), 3 => Color::olive(), 4 => Color::navy(), 5 => Color::purple(), 6 => Color::teal(), 7 => Color::silver(), 8 => Color::gray(), 9 => Color::red(), 10 => Color::lime(), 11 => Color::yellow(), 12 => Color::blue(), 13 => Color::fuchsia(), 14 => Color::aqua(), 15 => Color::white(), 16..=231 => { // 6 x 6 x 6 cube of 216 colors. We need to decode from // // code = 16 + 36 × r + 6 × g + b let code_rgb = code - 16; let blue = code_rgb % 6; let code_rg = (code_rgb - blue) / 6; let green = code_rg % 6; let red = (code_rg - green) / 6; Color::from_rgb(cube_to_8bit(red), cube_to_8bit(green), cube_to_8bit(blue)) } 232..=255 => { // grayscale from (almost) black to (almost) white in 24 steps let gray_value = 10 * (code - 232) + 8; Color::from_rgb(gray_value, gray_value, gray_value) } } } /// Approximate a color by its closest 8-bit ANSI color (as measured by the perceived /// color distance). /// /// See: fn to_ansi_8bit(&self) -> u8 { let self_lab = self.to_lab(); ANSI_LAB_REPRESENTATIONS .iter() .min_by_key(|(_, lab)| ciede2000(&self_lab, lab) as i32) .expect("list of codes can not be empty") .0 } /// Return an ANSI escape sequence in 8-bit or 24-bit representation: /// * 8-bit: `ESC[38;5;CODEm`, where CODE represents the color. /// * 24-bit: `ESC[38;2;R;G;Bm`, where R, G, B represent 8-bit RGB values fn to_ansi_sequence(&self, mode: Mode) -> String { match mode { Mode::Ansi8Bit => format!("\x1b[38;5;{}m", self.to_ansi_8bit()), Mode::TrueColor => { let rgba = self.to_rgba(); format!("\x1b[38;2;{r};{g};{b}m", r = rgba.r, g = rgba.g, b = rgba.b) } } } } #[derive(Debug, Default, Clone, PartialEq)] pub struct Style { foreground: Option, background: Option, bold: bool, italic: bool, underline: bool, } impl Style { pub fn foreground(&mut self, color: &Color) -> &mut Self { self.foreground = Some(color.clone()); self } pub fn on>(&mut self, color: C) -> &mut Self { self.background = Some(color.borrow().clone()); self } pub fn bold(&mut self, on: bool) -> &mut Self { self.bold = on; self } pub fn italic(&mut self, on: bool) -> &mut Self { self.italic = on; self } pub fn underline(&mut self, on: bool) -> &mut Self { self.underline = on; self } pub fn escape_sequence(&self, mode: Mode) -> String { let mut codes: Vec = vec![]; if let Some(ref fg) = self.foreground { match mode { Mode::Ansi8Bit => codes.extend_from_slice(&[38, 5, fg.to_ansi_8bit()]), Mode::TrueColor => { let rgb = fg.to_rgba(); codes.extend_from_slice(&[38, 2, rgb.r, rgb.g, rgb.b]); } } } if let Some(ref bg) = self.background { match mode { Mode::Ansi8Bit => codes.extend_from_slice(&[48, 5, bg.to_ansi_8bit()]), Mode::TrueColor => { let rgb = bg.to_rgba(); codes.extend_from_slice(&[48, 2, rgb.r, rgb.g, rgb.b]); } } } if self.bold { codes.push(1); } if self.italic { codes.push(3); } if self.underline { codes.push(4); } if codes.is_empty() { codes.push(0); } format!( "\x1b[{codes}m", codes = codes .iter() .map(|c| c.to_string()) .collect::>() .join(";") ) } } impl From for Style { fn from(color: Color) -> Style { Style { foreground: Some(color), background: None, bold: false, italic: false, underline: false, } } } impl From<&Color> for Style { fn from(color: &Color) -> Style { color.clone().into() } } impl From<&Style> for Style { fn from(style: &Style) -> Style { style.clone() } } impl From<&mut Style> for Style { fn from(style: &mut Style) -> Style { style.clone() } } pub trait ToAnsiStyle { fn ansi_style(&self) -> Style; } impl ToAnsiStyle for Color { fn ansi_style(&self) -> Style { self.clone().into() } } #[cfg(not(windows))] pub fn get_colormode() -> Option { use std::env; let env_nocolor = env::var_os("NO_COLOR"); if env_nocolor.is_some() { return None; } let env_colorterm = env::var("COLORTERM").ok(); match env_colorterm.as_deref() { Some("truecolor") | Some("24bit") => Some(Mode::TrueColor), _ => Some(Mode::Ansi8Bit), } } #[cfg(windows)] pub fn get_colormode() -> Option { use std::env; let env_nocolor = env::var_os("NO_COLOR"); match env_nocolor { Some(_) => None, // Assume 24bit support on Windows None => Some(Mode::TrueColor), } } #[derive(Default, Debug, Clone, Copy)] pub struct Brush { mode: Option, } impl Brush { pub fn from_mode(mode: Option) -> Self { Brush { mode } } pub fn from_environment(stream: Stream) -> Result { let mode = if atty::is(stream) { let env_color_mode = std::env::var("PASTEL_COLOR_MODE").ok(); match env_color_mode.as_deref() { Some(mode_str) => Mode::from_mode_str(mode_str)?, None => get_colormode(), } } else { None }; Ok(Brush { mode }) } pub fn paint(self, text: S, style: impl Into