src/Intervention/Gif/Decoded.php
public function countGlobalColors()
    {
        $byte = substr($this->logicalScreenDescriptor, 4, 1);

        if (strlen($byte) == 1) {
            $byte = unpack('C', $byte)[1];
            $bit = $byte & bindec('00000111');
        }
        
        // length of the global color table is 2^(N+1)        
        return isset($bit) ? pow(2, $bit + 1) : 0;
    }
public function countGlobalColors()
    {
        $byte = substr($this->logicalScreenDescriptor, 4, 1);

        if (strlen($byte) == 1) {
            $byte = unpack('C', $byte)[1];
            $bit = $byte & bindec('00000111');
        }
        
        // length of the global color table is 2^(N+1)        
        return isset($bit) ? pow(2, $bit + 1) : 0;
    }
Get number colors in global color palette

@return int